blob: 6ce82fcd9f70b6bb71582e1aeda6f42ce3fed810 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()
|