From 32118bd22ae3acf5aea9c473db405498831e13ad Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 26 Apr 2021 13:07:08 -0500 Subject: Test commit --- DotsNBoxes.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'DotsNBoxes.py') diff --git a/DotsNBoxes.py b/DotsNBoxes.py index ebafcc2..14cdd2a 100644 --- a/DotsNBoxes.py +++ b/DotsNBoxes.py @@ -3,6 +3,7 @@ import collections from Algorithm import * from Board import * from Nodes import * +import MCTS class DotsNBoxes: # A class for managing the moves made by the human and the computer @@ -15,19 +16,21 @@ class DotsNBoxes: # A class for managing the moves made by the human and the com def Human(self): # Defining the Human player and his actions/Choices self.State.Draw() - - # HumanX = int(input("Please enter the 'X' coordinate of your choice (an integer such as 4): ")) + + # HumanX = int(input("Please enter the 'X' coordinate of your choice (an integer such as 4): ")) # HumanY = int(input("Please enter the 'Y' coordinate of your choice (an integer such as 4): ")) - # if (HumanX, HumanY) not in self.State.children: + # if (HumanX, HumanY) not in self.State.children: # self.State.Make(HumanX, HumanY, False) - # self.State = self.State.children[(HumanX, HumanY)] - # else: # self.State = self.State.children[(HumanX, HumanY)] + + # else: + # self.State = self.State.children[(HumanX, HumanY)] + move = Algo.miniMax(self.State, 2) self.State = self.State.children[(move[0], move[1])] - print("AI selected the following coordinates to play:\n" + "(" ,str(move[0]), ", " + str(move[1]), ")", end = "\n\n") + print("AI1 selected the following coordinates to play:\n" + "(" ,str(move[0]), ", " + str(move[1]), ")", end = "\n\n") print("Current Score =====>> Your Score - AI Score = " + str(self.State.CurrentScore), end = "\n\n\n") @@ -42,10 +45,13 @@ class DotsNBoxes: # A class for managing the moves made by the human and the com def Computer(self): # Defining the Computer player and its actions/Choices self.State.Draw() + # Temporarily commented out. TODO hardcore MCTS into working then alternate comments lol move = Algo.miniMax(self.State, 3) - self.State = self.State.children[(move[0], move[1])] + # move = MCTS.MCTSGameController() # check what MCTSGameController returns? + + print("AI2 selected the following coordinates to play:\n" + "(" ,str(move[0]), ", " + str(move[1]), ")", end = "\n\n") print("Current Score =====>> Your Score - AI Score = " + str(self.State.CurrentScore), end = "\n\n\n") -- cgit v1.2.3