-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer_one.py
25 lines (21 loc) · 907 Bytes
/
player_one.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
from game import Game
from board import Board
class Player_One:
def __init__(self, p):
self.score = p # number of boxes you have filled in
def move(self, game):
# Your task: fill this in!
# should return a box duple index and which of its edges (0, 1, 2 or 3 = up right down left) to update
# example (dumb) algorithm shown.
cur_board = game.boards[len(game.boards) - 1]
for i in range(len(cur_board.grid)):
for j in range(len(cur_board.grid)):
if cur_board.grid[i][j].up == 0:
return [i, j, 0]
elif cur_board.grid[i][j].right == 0:
return [i, j, 1]
elif cur_board.grid[i][j].down == 0:
return [i, j, 2]
elif cur_board.grid[i][j].left == 0:
return [i, j, 3]
return [-1, -1, -1]