-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameState.py
34 lines (26 loc) · 989 Bytes
/
GameState.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import networkx as nx
# import matplotlib.pyplot as plt
from collections import defaultdict
#PLAYER2 IS AI value = 1
class GameState():
values = []
player = -1
def __init__(self, player, left1, right1, left2, right2):
self.player1 = 0
self.player2 = 1
GameState.values = defaultdict(list)
GameState.values[0].append(left1)
GameState.values[0].append(right1)
GameState.values[1].append(left2)
GameState.values[1].append(right2)
GameState.player = player
print(GameState.values[0])
print(GameState.values[1])
def hasWon(self, player_now):
# print(GameState.values[GameState.player][1])
return len(GameState.values[1-player_now]) == 1 and GameState.values[1-player_now].__contains__(2)
# return GameState.values[1-player_now].__contains__()
# if __name__ == '__main__':
# gs = GameState(1,2,3,5,7)
# print(gs.hasWon(1))
# g2 = GameState(1,44,33,22,11)