Saturday, December 8, 2007

A bug or not?

In the previous post, Michael mentioned in the comment stating the EGDB is good except a bug related to indefinite checking and chasing. I will take this chance to explain the situation. Chinese chess is different from western chess in interpreting indefinite checking/chasing. In western chess, three-fold repetitions lead to a draw. However, the win/draw/loss condition is depending on the context of checking/chasing in Chinese chess. The best solution I can come up so far is to treat indefinite checking/chasing as seed positions with win/draw/loss status based on Asian rules. Retrograde analysis was then used from this point on. This method lead to some problems (or bugs in some people's mind). First of all, distance to mate is hard to define if indefinite checking/chasing is involved. How many moves will you count when the losing side repetitive checks several times then moves to an inferior position? Since I could not solve this problem, I define the indefinite checking/chasing positions as seed positions with order. They are treated as final positions if the losing side refuses to change the pattern and is declared loss. In this case, this is the terminal node. However, if the losing side finally decide to move to inferior position with lesser order, there are more moves to be played. Take the first position raised by Michael as example, 硨七進三 keeps the following positions in the order 0. By keeping the positions in order 0, final win is ensured with certain depth. However, 硨七進二 will force positions to order 1, then drop back to order 0. We don't know for sure it is a longer sequence or shorter one. My current strategy is to keep it in lower order. As for the second position, moving red pawn left and right will force black knight to indefinitely chasing, so it has to move out of pattern or lose immediately. However, keep moving red pawn left will also force black knight to break out chasing pattern. These are two different ways to win. I propose a way for sure win. However, it may not be the shortest win due to the indefinite checking/chasing condition. To some people, it is not "perfect" in the sense it is not aesthetic to their point of view. To me, it is a practical way to solve indefinite checking/chasing situation with perfect win/draw/loss information. I don't have better solution so far. Is it a bug? To me, it is just a practical solution given the problem set. It's not a bug to me. :-)

No comments: