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
Max recursion depth exceeded #27
Comments
Most likely game logic error leading to infinite loop in traversing position tree. Game over condition can't be detected. |
Would it be possible to have it print the state that causes this? |
Any suggestions as to how to do so? |
You can catch the error by surrounding |
I've encountered the same problem. So I display the board using try / except. Here are some examples:
|
And I decided to print states after the exception. Oops!
|
@emc2314 Are the above snapshots from the same game? Could you share your exact code with the try except? |
Problem confirmed: My code is really kind of rubbish... I feel ashamed to put it here. |
This should be linked to #23. |
Related to the game logic, I'd propose to add the move validation into board.execute_move(). If the move supplied by an invoker is invalid for the current board position an error should be raised. I mean the rule that the player must not pass the move (a=-1) if he has one valid. |
Actually there is an assertion. alpha-zero-general/othello/OthelloLogic.py Line 111 in 2a37807
Sometimes it works, but sometimes it doesn't.. |
Addressed in f67e87e . |
Othello TF per below on iteration 1, epoch 10.
BTW: With TF less verbosity would be helpful (400 lines per epoch)
Training Net |############################### | (400/403) Data: 0.000s | Batch: 0.031s | Total: 0:00:12 | ETA: 0:00:01 | Loss_pi: 3.4790 |Training Net |############################### | (401/403) Data: 0.000s | Batch: 0.031s | Total: 0:00:12 | ETA: 0:00:01 | Loss_pi: 3.4789 |Training Net |############################### | (402/403) Data: 0.000s | Batch: 0.031s | Total: 0:00:12 | ETA: 0:00:01 | Loss_pi: 3.4789 |Training Net |################################| (403/403) Data: 0.000s | Batch: 0.031s | Total: 0:00:12 | ETA: 0:00:01 | Loss_pi: 3.4789 | Loss_v: 0.382
PITTING AGAINST PREVIOUS VERSION
/home/brian/hitme/bin/alpha-zero-general/MCTS.py:80: RuntimeWarning: invalid value encountered in true_divide
self.Ps[s] /= np.sum(self.Ps[s]) # renormalize
Traceback (most recent call last):
File "main.py", line 29, in
c.learn()
File "/home/brian/hitme/bin/alpha-zero-general/Coach.py", line 99, in learn
pwins, nwins, draws = arena.playGames(self.args.arenaCompare)
File "/home/brian/hitme/bin/alpha-zero-general/Arena.py", line 81, in playGames
gameResult = self.playGame(verbose=verbose)
File "/home/brian/hitme/bin/alpha-zero-general/Arena.py", line 46, in playGame
action = players[curPlayer+1](self.game.getCanonicalForm(board, curPlayer))
File "/home/brian/hitme/bin/alpha-zero-general/Coach.py", line 98, in
lambda x: np.argmax(nmcts.getActionProb(x, temp=0)), self.game)
File "/home/brian/hitme/bin/alpha-zero-general/MCTS.py", line 31, in getActionProb
self.search(canonicalBoard)
File "/home/brian/hitme/bin/alpha-zero-general/MCTS.py", line 106, in search
v = self.search(next_s)
File "/home/brian/hitme/bin/alpha-zero-general/MCTS.py", line 106, in search
v = self.search(next_s)
File "/home/brian/hitme/bin/alpha-zero-general/MCTS.py", line 106, in search
v = self.search(next_s)
[Previous line repeated 983 more times]
File "/home/brian/hitme/bin/alpha-zero-general/MCTS.py", line 103, in search
next_s, next_player = self.game.getNextState(canonicalBoard, 1, a)
File "/home/brian/hitme/bin/alpha-zero-general/othello/OthelloGame.py", line 31, in getNextState
b = Board(self.n)
File "/home/brian/hitme/bin/alpha-zero-general/othello/OthelloLogic.py", line 24, in init
for i in range(self.n):
RecursionError: maximum recursion depth exceeded in comparison
The text was updated successfully, but these errors were encountered: