-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBLOKUS.py
More file actions
47 lines (31 loc) · 979 Bytes
/
BLOKUS.py
File metadata and controls
47 lines (31 loc) · 979 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from ai import AI, BigFirstAI, SoftBigFirstAI, RecursiveAI, SelfOnlyRecursiveAI
from board import Board
def blokus():
main_board = Board(size=20)
players = []
players.append(BigFirstAI())
players.append(AI())
players.append(BigFirstAI())
players.append(BigFirstAI())
moves_left = True
turn_counter = 1
while moves_left:
moves_left = False
print(f"Turn {turn_counter}!")
turn_counter+=1
for p in players:
if p.has_valid_moves:
phands = []
for h in players:
phands.append(h.hand)
p.decide_action(main_board, playerhands=phands)
moves_left = True
print("Final Scores:")
for player in players:
print(f"Player {player.id}: {player.score}")
print("Final Board:")
for l in main_board:
print(l)
main_board.output_state()
if (__name__ == "__main__"):
blokus()