-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathplayer.py
62 lines (50 loc) · 1.84 KB
/
player.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import numpy as np
ROWS = 6
COLS = 7
TIMEOUT_MOVE = 1
TIMEOUT_SETUP = 1
MAX_INVALID_MOVES = 0
CONNECT_NUMBER=5
CYLINDER=False
timed_out = False
class Player:
def __init__(self, rows, cols, connect_number,
timeout_setup, timeout_move, max_invalid_moves,
cylinder):
self.rows = rows
self.cols = cols
self.connect_number = connect_number
self.timeout_setup = timeout_setup
self.timeout_move = timeout_move
self.max_invalid_moves = max_invalid_moves
self.cylinder = cylinder
def setup(self,piece_color):
"""
This method will be called once at the beginning of the game so the player
can conduct any setup before the move timer begins. The setup method is
also timed.
"""
pass
def play(self, board: np.ndarray):
"""
Given a 2D array representing the game board, return an integer value (0,1,2,...,number of columns-1) corresponding to
the column of the board where you want to drop your disc.
The coordinates of the board increase along the right and down directions.
Parameters
----------
board : np.ndarray
A 2D array where 0s represent empty slots, +1s represent your pieces,
and -1s represent the opposing player's pieces.
`index 0 1 2 . column` \\
`--------------------------` \\
`0 | 0. 0. 0. top` \\
`1 | -1 0. 0. .` \\
`2 | +1 -1 -1 .` \\
`. | -1 +1 +1 .` \\
`row | left bottom/right`
Returns
-------
integer corresponding to the column of the board where you want to drop your disc.
"""
raise NotImplementedError()
__all__ = ['Player']