aboutsummaryrefslogtreecommitdiffstats
path: root/Nodes.py
diff options
context:
space:
mode:
authorvehme003 <vehme003@umn.edu>2021-04-25 14:54:01 -0500
committerGitHub Enterprise <noreply-github@umn.edu>2021-04-25 14:54:01 -0500
commit1c7a9d1e88e44362b2303a2a591e4993e4dc458f (patch)
tree8bbba073ae0a576b335952f70807c158b571a9e0 /Nodes.py
parentDelete board2.py (diff)
downloadcsci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.tar
csci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.tar.gz
csci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.tar.bz2
csci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.tar.lz
csci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.tar.xz
csci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.tar.zst
csci4511w-1c7a9d1e88e44362b2303a2a591e4993e4dc458f.zip
Add files via upload
Diffstat (limited to '')
-rw-r--r--Nodes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Nodes.py b/Nodes.py
new file mode 100644
index 0000000..51a256b
--- /dev/null
+++ b/Nodes.py
@@ -0,0 +1,18 @@
+class Thing: # A class for Node related operations
+ def __init__(self, currentState):
+ self.Current = currentState
+ self.CurrentScore = 0
+ self.children = {}
+
+ def Make(self, i, j, player): # Function for generating a child node
+ self.children[(i, j)] = Thing(self.Current.Get_currentState())
+ mul = 1
+ if player:
+ mul *= -1
+ self.children[(i, j)].CurrentScore = (self.children[(i, j)].Current.action(i, j) * mul) + self.CurrentScore
+
+ def Populate(self, i, j, Child): # Function for adding a node
+ self.children[(i,j)] = Child
+
+ def Draw(self): # function for drawing the board
+ self.Current.Draw_mat() \ No newline at end of file