-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a new game from a FEN string #7
Comments
Making a Something close to this that I want to implement is creating a |
Mmm not sure I follow. Let's say I play a game until X position, generate a FEN string from there, store it, and continue playing another time from that same FEN string. |
If you're handling things like that, then yes you do know that the game is a valid one. You're guaranteeing it is because it originated from a game. However, putting in just any FEN string could lead to an invalid game state or a legally unreachable position. I'm not saying this isn't possible. An initializer from a FEN string would just need a validator that checks for things such as there's only one king per side and that castling rights correspond to king and rook squares. This would be a great feature to have because it would allow for deserialization of stored file data into |
I've added this initializer and seems be working:
It's good enough for my needs since I'm not saving moves history (at the moment) (Let me know if I'm missing something) |
It would be a lot safer to pass a |
FYI: With that change, and starting from a FEN string, everything seems to work, except the en passant rule, since it's calculated using _moveHistory and it's empty there. I've tried a quick hack but couldn't get it to work, I'll wait for you to implement it. You can use this FEN to test it: |
HI!, thanks for the previous issue!
Seems like you can create boards and positions, but I'm not seeing how to create a Game from it.
The text was updated successfully, but these errors were encountered: