Untitled
unknown
python
2 years ago
1.7 kB
7
Indexable
import chess games: list(str) = [] #TODO: insert games in FEN format k_values: list(int) = [1, 5, 10, 20] #TODO: define the exact values depths: list(int) = [2, 4, 6, 8] #TODO> define the exact values #right now, the simulator runs all the games. maybe we'll change in the future class Simulator: def __init__(self): self.games = games self.k_values = k_values self.depths = depths def run(self): """ pseudo-code: 0.for game in self.games: 1 foreach k in k_values: 1.1.foreach depth in depths: (means, we run all possible configurations of depth + k) 1.1.1. while game is not over: 1.1.1.1. white plays MINMAX-K(K, depth), black plays classic(depth) 1.1.1.2. board = curr_board <--- next_move (either white / black) 1.1.2. save result - 'A' 1.1.3. reset game to original position 1.1.4. while game is not over: 1.1.4.1. white plays classic(depth), black plays MINMAX-K(K, depth) 1.1.4.2. board = curr_board <--- next_move (either white / black) 1.1.5. save result - 'B' 1.1.6 report 'A' + 'B' """ for game_fen in self.games: for K in self.k_values: for depth in self.depths: board = chess.Board(game_fen) #white plays MINMAX-K, black plays classic while(!board.is_game_over()): board = white.next_move() # next move of MINMAX-K(K, depth) board = black.next_move() # next_move of alpha-beta(depth)
Editor is loading...