def main(file_path=FILE_LOCATION, game_number=16): network = Neural_Network() board = parse_training_file(file_path) inp = simulate(board) instance = inp[0][int(game_number)] # Some move within a game b = Board(instance) # Gather neural network outputs for each possible move on board outputs = gather_outputs(b, network) b.print_board() # Call with additional parameter False to prevent PDF output draw_graph(outputs)
def simulate(moves: MovesStruct, should_print: bool = False) -> TrainingDataStruct: board = Board() all_boards = [board.get_board()] p = -1 for x, y in moves: assert board.move(x, y, p) all_boards.append(board.get_board()) if should_print: board.print_board() winner, _ = board.decide_winner() if winner != 0: return all_boards, winner p = -p raise ValueError( 'Winner still not determined after all moves have been made.')