#! /usr/bin/python # Modified to conform to standards __author__="M@" __date__ ="$Nov 5, 2009 9:34:25 PM$" import OthelloModerator import random class OthelloPlayer: def makeMove(self, board, color): return self.getRandomMove(board, color) def getRandomMove(self, board_, color): board = OthelloModerator.OthelloBoard() board.board = board_ possibleMoves = range(64) random.shuffle(possibleMoves) for move in possibleMoves: if board.isLegalMove(move, color): return move return -1 if __name__ == "__main__": board = [0 for i in range(64)] board[27] = 1 board[28] = 2 board[35] = 2 board[36] = 1 print makeMove(board,1)