def learn(self, iterations): for i in range(0, iterations): board = ChessBoard.get_random_chessboard() self.parameter_set.calculate_parameters(board) rank = self.parameter_set.learning_move() if self.parameter_set.rank_higher(self.knowledge, rank): self.knowledge = self.parameter_set.update_knowledge(self.knowledge)
if __name__ == '__main__': draw = 0 win = 0 total = 1000.0 lit = [] for t in range(0,10): draw = 0 win = 0 for i in range(0,int(total)): board = ChessBoard.get_random_chessboard() if i % 1000 == 0: print i if play_random(board) is ChessBoard.DRAW: draw += 1 else: win += 1 lit.append((win,draw)) print lit print np.mean(np.array(lit)) print np.std(np.array(lit))