aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Vehmeier <vehme003@umn.edu>2021-04-27 13:37:43 -0500
committerJack Vehmeier <vehme003@umn.edu>2021-04-27 13:37:43 -0500
commitdea5598b51831b89f3f11e84db7d8a6418417590 (patch)
tree5cd2d369dd4ec853ed636e4ec95cde341785f4a6
parentchanged the get move to minimax (diff)
downloadcsci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.tar
csci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.tar.gz
csci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.tar.bz2
csci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.tar.lz
csci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.tar.xz
csci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.tar.zst
csci4511w-dea5598b51831b89f3f11e84db7d8a6418417590.zip
vehme003
-rw-r--r--python/GameState.py1
-rw-r--r--python/alphaBeta.py5
2 files changed, 3 insertions, 3 deletions
diff --git a/python/GameState.py b/python/GameState.py
index eed8f36..8957f7c 100644
--- a/python/GameState.py
+++ b/python/GameState.py
@@ -36,7 +36,6 @@ class DotsAndBoxesState(GameState):
columns.append({"v": 0, "h": 0})
rows.append(columns)
self.board = rows
-
self.score = {1: 0, 2: 0}
self.player = player
print("Player: ", player)
diff --git a/python/alphaBeta.py b/python/alphaBeta.py
index 66040d5..c15f371 100644
--- a/python/alphaBeta.py
+++ b/python/alphaBeta.py
@@ -41,9 +41,10 @@ class ABNode(object): # A class for Node related operations
class AlphaBeta(object):
def miniMax(State, Ply_num): # Function for the minimax algorithm
+ start=ABNode(State)
possiblemoves=State.get_moves()
for x in possiblemoves:
- if (x[0],x[1],x[2]) not in State.children:
+ if (x[0],x[1],x[2]) not in start.children:
State.Make(x[0],x[1],x[2])
if Ply_num < 2:
return (i, j)
@@ -52,7 +53,7 @@ class AlphaBeta(object):
r = 0
c = 0
o = ""
- for k, z in State.children.items():
+ for k, z in start.children.items():
Result = Algo.Maximum(z, Ply_num - 1, Minimum_Score)
if Minimum_Score > Result:
Minimum_Score = Result