aboutsummaryrefslogtreecommitdiffstats
path: root/Jack/node2.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 /Jack/node2.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 'Jack/node2.py')
-rw-r--r--Jack/node2.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Jack/node2.py b/Jack/node2.py
new file mode 100644
index 0000000..6ce82fc
--- /dev/null
+++ b/Jack/node2.py
@@ -0,0 +1,17 @@
+from board2 import *
+
+class Node:
+ def __init__(self, currentState):
+ self.curr = currentState #this is a board
+ self.score = 0
+ self.children = {}
+
+ def make_state(self, v1, v2, p1): # Function for generating a child node
+ self.children[(v1, v2)] = Node(self.curr.get_board)
+ if (not p1):
+ self.children[(v1, v2)].score = (self.children[(v1, v2)].curr.play_move(v1, v2) * -1) + self.score
+ else:
+ self.children[(v1, v2)].score = (self.children[(v1, v2)].curr.play_move(v1, v2)) + self.score
+
+ def print(self): # function for drawing the board
+ self.curr.print_board() \ No newline at end of file