Closed tobei closed 8 years ago
You are right, I had not foreseen a move that would take 1 stone and be immediately recapturable without being a ko. But there is this type of "feeding stones to opponent move". It seems like the playable demo is a bit lacking, then, it should count not only taken stones (must be 1 for ko), but stones in capturing group as well (must be 1 for ko as well, otherwise it's OK to retake).
Joonas
On Sat, Dec 19, 2015 at 12:31 PM, tobei notifications@github.com wrote:
I might be wrong but i played a bit on the play demo pages, and it appeared that when a piece is taken, you can't replay the exact same position and take back as it would violate the ko rule.
But from the rules i know, if playing there would lead to the capture of another group (or a larger group containing) the stone that made the capture, it isn't a ko anymore.
It is my understanding than the only way a ko or super-ko could be evaluated is if it leads (or would lead) to a same board position that already occured (right) before.
— Reply to this email directly or view it on GitHub https://github.com/jokkebk/jgoboard/issues/5.
The most general room for ko being to avoid that the exact same board occurs twice, i think it safe to assume that it can only happen when when one stone is taken, and then the recapture only takes the last played opponent stone. If the new capture is two or more stones, or if the intial capture is two or more stone, you don't need to do any checks. Only two consecutive "1 stone captures" can have the unfortunate effect to recapture the previous stone and restore a previous board state.
Now there is the super ko, where an old board can be restored in after a succession of two or more turns, leading to a cycle that would never end the game. That one is more annoyed to solve, but there are two ways... the first one is intensive, it's keeping old board positions, and compare, the second one and easiest is to compute an inprint (hash) of the board position, mutate that imprint every move, and compare to see if it matches a previous imprint. You can find that particular hashing for a board of go (or chess) there: https://en.wikipedia.org/wiki/Zobrist_hashing It's called "Zobrist hashing" :) Hope it helps... (but honestly solving just the immediate ko would be enough for me) ^^
I've added a new check to ko that sees if the capturing stone has any adjacent stones of same color. If there are, the move cannot be ko (as there is now a group of multiple stones, so taking those would not result in immediate replay of previous board position).
There's still no superko check, I think that is best left for higher level logic, as some rules do allow for it.
I might be wrong but i played a bit on the play demo pages, and it appeared that when a piece is taken, you can't replay the exact same position and take back as it would violate the ko rule.
But from the rules i know, if playing there would lead to the capture of another group (or a larger group containing) the stone that made the capture, it isn't a ko anymore.
It is my understanding than the only way a ko or super-ko could be evaluated is if it leads (or would lead) to a same board position that already occured (right) before.