Skip to content
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

Get KeyError on undoMove() #7

Closed
coolusaHD opened this issue Jan 12, 2022 · 2 comments
Closed

Get KeyError on undoMove() #7

coolusaHD opened this issue Jan 12, 2022 · 2 comments

Comments

@coolusaHD
Copy link
Contributor

Description

it dont happen very often but when it happen I cannot found any problem in my code.
I'm using undo move like this in my code

gs.makeMove(move)
score = RekursiveFunktion(x,y)
gs.undoMove()

Error Output

Process Process-6:
Traceback (most recent call last):
  File "C:\Projekte\chess_ai\ChessEngine.py", line 177, in undoMove
    self.game_log[tuple(self.board)] -= 1
KeyError: ('--', 'bR', 'bN', 'bK', 'bB', 'bR', '--', 'bp', 'bp', '--', 'bp', 'bp', '--', 'bB', '--', 'bp', '--', '--', '--', '--', '--', 'wp', 'wp', 'wp', 'wp', 'wp', 'wp', '--', '--', 'wR', 'wR', 'wB', 'wN', 'wK', '--', 'wR')
@toddChavezz
Copy link
Collaborator

does your recursive function also operate on the GameState object? do you have a board position and corresponding move that is undone for which this happens? My AI basically operates the same way and I didn't encounter this so far.

@coolusaHD
Copy link
Contributor Author

I think my mobility function which operates on the same gamestate was the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants