-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_class.py
36 lines (31 loc) · 1.44 KB
/
board_class.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
class board():
"""
The board class is a dictionary of dictionaries.
This allows us to access the array in minimal time, and also
allows us to keep it in order and good to go
"""
def __init__(self, size):
self.board = {}
self.sizes = size
for row in range(1,size+1):
self.board[row] = {} ##Set the board to be full of dictionaries
for column in range(1,size+1):
self.board[row][column] = "EMPTY" ##Initialize to empty
def getLocation(self, row, col):
return self.board(row,col)
def setLocation(self, row, col, piece):
if self.board[row][col] == "EMPTY":
self.board[row][col] = piece
return 0 #good, piece was set correctly
else:
print "bad move"
return -1
def movePieceFrom(rowOrig, colOrig, rowNew, ColNew, piece):
print "finish this later"
def printBoard(self):
print "---Piece---------| Row |---| Column |---"
for row in self.board.keys():
for col in self.board[row].keys():
if self.board[row][col] != "EMPTY":
print self.board[row][col].printPiece(), " ", row, "\t\t", col ##if it is not "empty" then it is a piece, print that shit
##print "FALSE" #there ain't shit here! Removed the print, just clutters shit up brah!