forked from udacity/AIND-Isolation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent_test.py
36 lines (25 loc) · 986 Bytes
/
agent_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""This file is provided as a starting template for writing your own unit
tests to run and debug your minimax and alphabeta agents locally. The test
cases used by the project assistant are not public.
"""
import unittest
# See https://docs.python.org/3/library/unittest.html#basic-example for example
import timeit
import isolation
import game_agent
from importlib import reload
class IsolationTest(unittest.TestCase):
"""Unit tests for isolation agents"""
def setUp(self):
reload(game_agent)
self.player1 = "Player1"
self.player2 = "Player2"
self.game = isolation.Board(self.player1, self.player2)
def test_minimax_player(self):
agent = game_agent.MinimaxPlayer()
time_millis = lambda: 1000 * timeit.default_timer()
move_start = time_millis()
time_left = lambda: 100 - (time_millis() - move_start)
move = agent.get_move(self.game, time_left)
if __name__ == '__main__':
unittest.main()