def add_ai(self): p=[] for i in range(1000): newph=players.AI_prob(0.8,0.8,1,0.5,0) p.append(newph) newph=players.AI(1,0.5,0,0.2,0) p.append(newph) return p
def __init__(self, resolution): self.resolution = resolution self.engine = engine.GfxEngine(self.resolution) self.game_state = state.GameState([]) self.history = [] # one player by default self.player_list = [ players.Human("white"), players.AI("black", "random") ]
def __init__(self, typePlayer1, typePlayer2, numberOfRounds, verbose=False): self.numberOfRounds = numberOfRounds if typePlayer1 == "ai": self.player1 = players.AI(1) elif typePlayer1 == "human": self.player1 = players.Human(1) elif typePlayer1 == "test": self.player1 = players.Player(1) else: raise ValueError("typePlayer1 not understood") if typePlayer2 == "ai": self.player2 = players.AI(2) elif typePlayer2 == "human": self.player2 = players.Human(2) elif typePlayer2 == "test": self.player2 = players.Player(2) else: raise ValueError("typePlayer2 not understood") self.scores = [0, 0] self.verbose = verbose
def __init__(self, master): self.master = master self.game = chessgame.ChessGame() self.history = [] #the history which is shown in the listbox self.gui = gui.Gui(self) self.gui.gameDisplay.game = self.game self.players = [None, None] self.players[const.WHITE] = players.Human(self, const.WHITE) self.players[const.BLACK] = players.AI(self, const.BLACK) self.game.setBoard(mat.TESTBOARD) self.master.bind("<<turn_complete>>", self.turnComplete)