Skip to content

Commit

Permalink
fix(cli): prevent consecutive moves of the same player in GTP mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxvanyang committed Jun 24, 2024
1 parent 8739726 commit 59e7d85
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/mygo/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ def run_gtp(self) -> Game:
)
continue

if player != game.next_player:
command.print_output(
"consecutive moves of the same color are not allowed",
success=False,
)
continue

try:
move = from_gtp_move(vertex, player)
except ValueError:
Expand Down Expand Up @@ -330,6 +337,13 @@ def run_gtp(self) -> Game:
command.print_output("invalid color", success=False)
continue

if player != game.next_player:
command.print_output(
"consecutive moves of the same color are not allowed",
success=False,
)
continue

move = self.bot.select_move(game, player)
game.apply_move(move)
command.print_output(str(move))
Expand Down

0 comments on commit 59e7d85

Please sign in to comment.