-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameStates.py
36 lines (28 loc) · 1.06 KB
/
GameStates.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
30
31
32
33
34
35
36
import numpy as np
import matplotlib.pyplot as plt
from GameState import GameState
class GameStates:
def __init__(self):
self.boardStack = np.zeros((82, 9, 9, 2), dtype=np.float32)
self.stateStack = [GameState(board) for board in self.boardStack]
self.boardCount = 82
def __str__(self):
return f"Boardstack shape: {self.boardStack.shape}. stateStack shape: {len(self.stateStack)}"
def copyToIndex(self, index, gameState):
self.boardStack[index] = np.copy(gameState.board)
self.stateStack[index].blackStonesCaptured = gameState.blackStonesCaptured
self.stateStack[index].whiteStonesCaptured = gameState.whiteStonesCaptured
self.stateStack[index].passedStreak = gameState.passedStreak
def show(self):
fig, axs = plt.subplots(9,9, figsize=(18, 19))
axs = axs.flatten()
for i in range(self.boardCount - 1):
self.stateStack[i+1].show(axs[i])
def unitTestGameStates():
gameStates = GameStates()
gameStates.show()
print(gameStates)
plt.show()
#unitTestGameStates()
if __name__ == "__main__":
unitTestGameStates()