Skip to content

Commit a4f4659

Browse files
authored
Merge pull request #26 from udacity/conupdate-193
Print debug information when test case fails.
2 parents b4d588b + 31c6223 commit a4f4659

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Projects/3_Adversarial Search/tests/test_my_custom_player.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from random import choice
66
from textwrap import dedent
77

8-
from isolation import Isolation, Agent, fork_get_action, play
8+
from isolation import Isolation, Agent, fork_get_action, play, DebugState
99
from sample_players import RandomPlayer
1010
from my_custom_player import CustomPlayer
1111

@@ -60,5 +60,10 @@ def test_custom_player(self):
6060
moves = deque(game_history)
6161
while moves: state = state.result(moves.popleft())
6262

63-
self.assertTrue(state.terminal_test(), "Your agent did not play until a terminal state.")
63+
if not state.terminal_test():
64+
print(f"Your agent with id:{state.player()} was not able to make a move in state:")
65+
debug_state = DebugState.from_state(state)
66+
print(debug_state)
67+
68+
raise Exception("Your agent did not play until a terminal state.")
6469

0 commit comments

Comments
 (0)