-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
30 lines (23 loc) · 760 Bytes
/
Copy pathgame.py
File metadata and controls
30 lines (23 loc) · 760 Bytes
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
from board import Board, RED, YELLOW
from player import Player
class Game:
def __init__(self, model_red, model_yellow):
self.board = Board()
self.players = {
RED: Player(model_red, RED),
YELLOW: Player(model_yellow, YELLOW),
}
def reset(self):
self.board = Board()
def move(self):
self.players[self.board.turn].move(self.board)
def is_active(self):
return self.board.is_active()
def thoughts(self, player):
return self.players[player].thoughts()
def run(self):
while self.is_active():
current_player = self.board.turn
self.move()
print(self.board.visual())
print(self.thoughts(current_player))