diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3d3a273..6f6415e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -25,7 +25,7 @@ jobs: pipenv install --dev - name: Check formatting - run: pipenv run black --target-version=py310 . + run: pipenv run black --target-version=py311 . - name: Check types run: pipenv run mypy rps rps-sim.py diff --git a/rps-sim.py b/rps-sim.py index 5faebdc..d2a89fb 100644 --- a/rps-sim.py +++ b/rps-sim.py @@ -5,9 +5,13 @@ from rps.game import play_games - @click.command -@click.option("--games", default=3, type=click.IntRange(min=1, max=1000), help="Number of games to play") +@click.option( + "--games", + default=3, + type=click.IntRange(min=1, max=1000), + help="Number of games to play", +) @click.option("--p1-name", default="Player 1", help="Name of first player") @click.option("--p2-name", default="Player 2", help="Name of second player") def simple_sim(games: int, p1_name: str, p2_name: str) -> None: @@ -22,5 +26,5 @@ def simple_sim(games: int, p1_name: str, p2_name: str) -> None: print("Simulation finished.") -if __name__ == '__main__': - simple_sim() \ No newline at end of file +if __name__ == "__main__": + simple_sim() diff --git a/rps/game.py b/rps/game.py index 7899698..d0a7962 100644 --- a/rps/game.py +++ b/rps/game.py @@ -1,13 +1,16 @@ from .player import Player from .play import PlayResult + def play_game(firstPlayer: Player, secondPlayer: Player) -> PlayResult: firstPlay = firstPlayer.play() secondPlay = secondPlayer.play() return firstPlay.match(secondPlay) -def play_games(firstPlayer: Player, secondPlayer: Player, times: int) -> list[PlayResult]: +def play_games( + firstPlayer: Player, secondPlayer: Player, times: int +) -> list[PlayResult]: results = [] for _ in range(times): results.append(play_game(firstPlayer, secondPlayer)) diff --git a/rps/player.py b/rps/player.py index f20ed59..925cb2f 100644 --- a/rps/player.py +++ b/rps/player.py @@ -17,5 +17,5 @@ def __init__(self, play_strategy: PlaySelectionStrategy, name: str = "Bot Player self.__strategy = play_strategy self.name = name - def play(self) -> Play: + def play(self) -> Play: return self.__strategy.play()