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 53 forks source link

Ko detection fails after app restart #372

Closed herzbube closed 2 years ago

herzbube commented 2 years ago

Steps to reproduce:

Expected: The game prevents you from playing B A1 because this is a ko move. Actual: The game lets you play B A1, then reports that Fuego rejected the move.

herzbube commented 2 years ago

The problem is that Zobrist hashes are not calculated correctly when the app restores its state after a restart.

The issue was introduced by the fix for bug #357. The fix removed the archiving of GoMove properties next and previous to avoid a stack overflow error. Instead the fix introduced relinking moves after an app restart, but the relinking occurs too late, i.e. after Zobrist hash calculation.