aboutsummaryrefslogtreecommitdiffstats
path: root/Not Jack/Nodes.py
diff options
context:
space:
mode:
authorRossTheRoss <mstrapp@protonmail.com>2021-04-13 17:22:52 -0500
committerRossTheRoss <mstrapp@protonmail.com>2021-04-13 17:22:52 -0500
commit77a99164bb53b207ba8efec1a37238379f595f44 (patch)
tree47f95873e3f005749853efb5d9e2c6f986c077a8 /Not Jack/Nodes.py
parentRearrange things more I guess (diff)
downloadcsci4511w-77a99164bb53b207ba8efec1a37238379f595f44.tar
csci4511w-77a99164bb53b207ba8efec1a37238379f595f44.tar.gz
csci4511w-77a99164bb53b207ba8efec1a37238379f595f44.tar.bz2
csci4511w-77a99164bb53b207ba8efec1a37238379f595f44.tar.lz
csci4511w-77a99164bb53b207ba8efec1a37238379f595f44.tar.xz
csci4511w-77a99164bb53b207ba8efec1a37238379f595f44.tar.zst
csci4511w-77a99164bb53b207ba8efec1a37238379f595f44.zip
Rearrange and add more
Diffstat (limited to '')
-rw-r--r--Not Jack/Nodes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Not Jack/Nodes.py b/Not Jack/Nodes.py
new file mode 100644
index 0000000..da01944
--- /dev/null
+++ b/Not Jack/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()