-
Notifications
You must be signed in to change notification settings - Fork 1
/
board.py
58 lines (48 loc) · 1.67 KB
/
board.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
empty = '.'
red = 'r'
black = 'b'
colums = 7
rows = 6
def start_new_board_game()
'''
Creates a new game board. Initially, a game board has the size
BOARD_COLUMNS x BOARD_ROWS and is comprised only of strings with the
value empty
'''
board = []
for col in range(columns):
board.append([])
for row in range(rows):
board[-1].append(empty)
return board
def drop_token(board, column, color, x, y):
'''
This drops a point in a specific spot that the user inputs.
'''
drop_point = in board.drop.color(column.(x,y))
def move_is_valid(board, column):
'''
This will check the board for empty spaces.
'''
if board.columns.(7, 6) == True:
if board.columns.(6, 6) == True:
if board.columns.(5, 6) == True:
if board.columns.(4, 6) == True:
if board.columns.(3, 6) == True:
if board.columns.(2, 6) == True:
if board.columns.(1, 6) == True:
return True
if board.columns.(7, 6) == False:
if board.columns.(6, 6) == False:
if board.columns.(5, 6) == False:
if board.columns.(4, 6) == False:
if board.columns.(3, 6) == False:
if board.columns.(2, 6) == False:
if (oard.columns.(1, 6) == False:
return False
def main():
board = start_new_board_game()
if move_is_valid(board, colums) == True:
drop_token(board, colums, color, x, y)
else:
# I don't know what to write here can you help please.?