aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2021-06-17 20:13:41 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2021-06-17 20:13:41 +0200
commit25e4e5fb3a77c8da65a2e7b42b7d77ba8f1b21a1 (patch)
treefc45d496d5a3b961ceaedd026afe8bb1f8c54994 /tests
parent4a39a8fd07e49db5feb0c403b784423f0b673f97 (diff)
downloadimago-25e4e5fb3a77c8da65a2e7b42b7d77ba8f1b21a1.tar.gz
imago-25e4e5fb3a77c8da65a2e7b42b7d77ba8f1b21a1.zip
Engine now uses MCTS algorithm.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_monteCarlo.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/test_monteCarlo.py b/tests/test_monteCarlo.py
index 8fe6f47..283c657 100644
--- a/tests/test_monteCarlo.py
+++ b/tests/test_monteCarlo.py
@@ -2,21 +2,29 @@
import unittest
-from imago.gameLogic.gameBoard import GameBoard
-from imago.gameLogic.gameMove import GameMove
+from imago.gameLogic.gameState import GameState
+from imago.engine.monteCarlo import MCTS
from imago.engine.monteCarlo import MCTSNode
-TEST_BOARD_SIZE = 19
+TEST_BOARD_SIZE = 9
class TestMonteCarlo(unittest.TestCase):
"""Test MonteCarlo algorithm."""
- def testSimulation(self):
- """Test calculation of group liberties."""
- board = GameBoard(TEST_BOARD_SIZE, TEST_BOARD_SIZE)
- move = GameMove(board)
- node = MCTSNode(move, None)
- node.simulation()
+ def testPickMove(self):
+ """Test picking a move."""
+ state = GameState(TEST_BOARD_SIZE)
+ tree = MCTS(state)
+ print(tree.pickMove().toString())
+
+ #def testSimulation(self):
+ # """Test calculation of group liberties."""
+ # board = GameBoard(TEST_BOARD_SIZE, TEST_BOARD_SIZE)
+ # move = GameMove(board)
+ # node = MCTSNode(move, None)
+ # nMatches = 100
+ # scoreDiffHeur = 15
+ # node.simulation(nMatches, scoreDiffHeur)
if __name__ == '__main__':
unittest.main()