From 79a2fa6eba1648bf2beaaf534d1fa3247c0d6a01 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Wed, 1 Jun 2022 20:14:15 +0200 Subject: Some redesigning. --- tests/test_monteCarlo.py | 4 ++-- tests/test_parseHelpers.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_monteCarlo.py b/tests/test_monteCarlo.py index 283c657..b217cf9 100644 --- a/tests/test_monteCarlo.py +++ b/tests/test_monteCarlo.py @@ -14,8 +14,8 @@ class TestMonteCarlo(unittest.TestCase): def testPickMove(self): """Test picking a move.""" state = GameState(TEST_BOARD_SIZE) - tree = MCTS(state) - print(tree.pickMove().toString()) + tree = MCTS(state.lastMove) + #print(tree.pickMove().toString()) #def testSimulation(self): # """Test calculation of group liberties.""" diff --git a/tests/test_parseHelpers.py b/tests/test_parseHelpers.py index cf1fa9f..d03f253 100644 --- a/tests/test_parseHelpers.py +++ b/tests/test_parseHelpers.py @@ -20,6 +20,7 @@ class TestParseHelpers(unittest.TestCase): self.assertEqual(parseHelpers.parseMove(["B", "A1", "W"], TEST_BOARD_SIZE), parseHelpers.ParseCodes.ERROR) + parsedMove = parseHelpers.parseMove(["B", "t1"], TEST_BOARD_SIZE) targetMove = parseHelpers.GtpMove(Player.BLACK, [18, 18]) @@ -67,6 +68,10 @@ class TestParseHelpers(unittest.TestCase): "A19", TEST_BOARD_SIZE), [0,0]) + self.assertEqual(parseHelpers.parseVertex( + "pass", TEST_BOARD_SIZE), + "pass") + def testVertexToString(self): """Test converting vertices to strings.""" self.assertEqual(parseHelpers.vertexToString([0,0], TEST_BOARD_SIZE), "A19") @@ -78,6 +83,8 @@ class TestParseHelpers(unittest.TestCase): self.assertEqual(parseHelpers.vertexToString([18,0], TEST_BOARD_SIZE), "A1") self.assertEqual(parseHelpers.vertexToString([18,18], TEST_BOARD_SIZE), "T1") + self.assertEqual(parseHelpers.vertexToString("pass", TEST_BOARD_SIZE), "pass") + self.assertEqual(parseHelpers.vertexToString([-1,0], TEST_BOARD_SIZE), parseHelpers.ParseCodes.ERROR) self.assertEqual(parseHelpers.vertexToString([0,-1], TEST_BOARD_SIZE), -- cgit v1.2.1