Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chessboard = [ [None]*8 ]*8 # 2d array to store piece placements
- def setup_chessboard(chessboard):
- # assign initial pieces
- return chessboard
- def move_piece(chessboard, currentLocation, newLocation):
- # moves a piece
- # takes a piece if the enemy has one there
- return chessboard
- setup_chessboard(chessboard)
- move_piece(chessboard, 'a2', 'a3')
- class Chessboard:
- # runs whenever you create a new instance of a class
- def __init__(self):
- # do the setup stuff like in setup_chessboard
- self.board = [[None]*8]*8
- def move_piece(self, currentLocation, newLocation):
- # move stuff
- pass
- chessboard = Chessboard()
- chessboard.move_piece('a2', 'a3')
Advertisement
Add Comment
Please, Sign In to add comment