aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvehme003 <vehme003@umn.edu>2021-04-12 15:04:17 -0500
committerGitHub Enterprise <noreply-github@umn.edu>2021-04-12 15:04:17 -0500
commit6631fc6b98be4198b742962d603416e76f58a1f2 (patch)
tree3b1a2748f041be74f636cdb946f39d06654a2b00
parentUpdate board2.py (diff)
downloadcsci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.tar
csci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.tar.gz
csci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.tar.bz2
csci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.tar.lz
csci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.tar.xz
csci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.tar.zst
csci4511w-6631fc6b98be4198b742962d603416e76f58a1f2.zip
Add files via upload
-rw-r--r--node2.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/node2.py b/node2.py
new file mode 100644
index 0000000..6ce82fc
--- /dev/null
+++ b/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