herzbube / littlego

Little Go. An iOS application that lets you play the game of Go on the iPhone or iPad.
https://littlego.herzbube.ch/
Apache License 2.0
138 stars 54 forks source link

Crash when board setup changes but game has ended due to resignation #398

Closed herzbube closed 1 year ago

herzbube commented 1 year ago

Repro steps:

  1. Start new game
  2. Switch to "Board setup" mode
  3. Place a stone
  4. Switch back to "Play" mode
  5. Resign
  6. Tap "More Game Actions" button
  7. From the menu select "Board setup"
  8. Either a) place a stone, or b) discard all setup stones, or c) set a side to play first (from the "More Game Actions" menu)

Expected: Game state should be reverted to "in progress" (from "has ended" with reason "resigned by ...") and the board setup operation succeeds.

Actual: The game state is not reverted to "in progress" and the app crashes.

herzbube commented 1 year ago

The initial fix was to not display the "Board setup" item in the "More Game Actions" menu when the game has already ended. This fix proved to be insufficient because it prevented the user from entering board setup mode when on board position 0, and then discarding future moves by performing any kind of board setup operation. Instead the user was forced to 1) jump forward to the end of the game, 2) revert the game state manually to "in progress", 3) return to "start of the game" board position and 4) finally enter board setup mode.

The second fix now makes sure when any kind of board setup operation occurs that the game state is reverted to "in progress" even when there are no moves or other nodes beyond the one at the start of the game.