-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.py
45 lines (34 loc) · 1.17 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
#!/usr/bin/python3
from brain import *
class MyBoard:
def __init__(self):
board = []
boardSize = 0
value = []
def createBoard(self, size):
self.boardSize = size
self.board = [[0 for j in range(size)] for i in range(size)]
self.value = [[0 for j in range(size)] for i in range(size)]
def displayBoard(self):
cnt = 0
while (cnt < self.boardSize):
print(self.board[cnt])
cnt += 1
def getBoard(self):
return (self.board)
def getSizeBoard(self):
return (self.boardSize)
def doMove(self, x, y, player):
if (self.isCaseUsable(x, y) == True):
self.board[x][y] = player
def removeMove(self, x, y):
if (self.board[x][y] != 0):
self.board[x][y] = 0
def isCaseUsable(self, x, y) -> bool:
if (x < self.boardSize and y < self.boardSize and x >= 0 and y >= 0):
if (self.board[x][y] == 0):
return (True)
return (False)
def getStringForPattern(self, x, y, size):
string = ""
return (string)