/ Published in: Python
Expand |
Embed | Plain Text
import copy class GameBoard: number_of_rows = 3 rows = [] global random_puzzle def __getstate__(self): return self.rows def __setstate__(self, rows): self.rows = rows def __init__(self): return def getgameboard(self): return self.rows def perform(self, move): self.rows.append(move) return def legalmoves(self): return ['a1', 'a2', 'a3'] seq = 1 gb = GameBoard() moves = [] while seq < 4: possibilities = gb.legalmoves() gb.perform(possibilities[0]) moves.append(copy.deepcopy(gb)) seq = seq + 1 for move in moves: print move.getgameboard()
You need to login to post a comment.
