[F] A2 pyta warnings
This commit is contained in:
@@ -205,13 +205,13 @@ def part2_runner(d: int, n: int, white_greedy: bool) -> None:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# import python_ta
|
||||
# python_ta.check_all(config={
|
||||
# 'max-line-length': 100,
|
||||
# 'max-nested-blocks': 4,
|
||||
# 'disable': ['E1136'],
|
||||
# 'extra-imports': ['random', 'a2_minichess', 'a2_game_tree']
|
||||
# })
|
||||
import python_ta
|
||||
python_ta.check_all(config={
|
||||
'max-line-length': 100,
|
||||
'max-nested-blocks': 4,
|
||||
'disable': ['E1136'],
|
||||
'extra-imports': ['random', 'a2_minichess', 'a2_game_tree']
|
||||
})
|
||||
|
||||
# Sample call to part2_runner (you can change this, just keep it in the main block!)
|
||||
part2_runner(5, 50, True)
|
||||
|
||||
@@ -54,7 +54,7 @@ class ExploringPlayer(a2_minichess.Player):
|
||||
self._game_tree = self._game_tree.find_subtree_by_move(previous_move)
|
||||
|
||||
# Tree has been explored, make a random choice
|
||||
if self._game_tree is None or len(self._game_tree.get_subtrees()) == 0 :
|
||||
if self._game_tree is None or len(self._game_tree.get_subtrees()) == 0:
|
||||
move = random.choice(game.get_valid_moves())
|
||||
|
||||
# "If the random number is < p, the player chooses a random move from among all valid moves
|
||||
@@ -119,6 +119,7 @@ def run_learning_algorithm(exploration_probabilities: list[float],
|
||||
a2_minichess.RandomPlayer())
|
||||
# After the game, insert move sequence with white win probability
|
||||
game_tree.insert_move_sequence(seq, float(winner == 'White'))
|
||||
results_so_far.append(winner)
|
||||
# Print progress
|
||||
print(f'Winner: {winner}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user