Code Monkey home page Code Monkey logo

Comments (2)

dn1z avatar dn1z commented on June 1, 2024

Hi, firstly thanks for the detailed issue description. I had a look at the game and in 42nd move, as you mentioned, while queens on both g8 and h1 can move to h7, due to the fact that queen on the g8 is pinned by white queen in c8, Qh7 is apparently the right way to show the move. However, there is no problem with PGN parser itself. The parser only parses the list of moves using regex and feeds the ChessGame object with these moves which creates the board state by applying the move by finding the original square where the piece in the move came from. To find the square where the piece came from (e.g. in the beginning, in the move Nf3, knight comes from g1 square), the algorithm checks pieces one by one (starting from 8th row and ending in 1st row which explains why it finds original square of the move Qh7 as g8) and when it finds a valid movement, it returns the square without further check in which your issue lies. In order to solve this issue, i should modify the original-square-finding algorithm to check for all pieces even it already found a match and when the program encounters with ambiguous move, it should try to invalidate all but one move (like Qgh7 is not possible as the queen is pinned). The ChessGame object does not implement all of the chess features, it only tries to get board state, and understands nothing else like king checks, checkmates, etc., so I may try to implement some of these features or use existing chess library for python. I will have look into this issue deeper and make necessary changes soon.

from pgn2gif.

ChaoticNeutralCzech avatar ChaoticNeutralCzech commented on June 1, 2024

Thank you for looking into the issue! Sadly, I won't be of much help anymore: I have read none of the repo's code and I'm helpless at OOP anyway, and as you may have guessed from the game, my (White's) strategic intelligence is at the level of a 9-year-old who just learnt how promotion works and what the word "harem" means. (Still better than Black though, who is just a dumb copycat.) So I didn't even realize that the queen was pinned - I only know chess rules, no strategy.

Due to lacking programming experience and English being my second language, I may have misused the word "parser" in place of "interpreter" or another more suitable denomination (perhaps the appropriate function has a name in the code but I haven't read it, sorry).

By the way, this project is awesome for its purpose, and though the quality could have been better than 480p, I won't complain. For this reason, I looked no further than here for the export of my games, though the option for the duration of individual frames seems like a missing basic feature (fortunately, GIF editors make up for it). What I find best about this SW is its good use of the redefinable 256-color palette (unlike Chess.com's GIF creator, which even dithers colors of the board!) (Well, this should not be a surprise when you compare someone's love project on Github to a corporation's proprietary code they wanted to get done ASAP.)

Cheers!

from pgn2gif.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.