🕸📝Fergus Duniho wrote on Fri, Apr 27, 2012 05:30 PM UTC:
I have just added support for the 50 moves rule in Chess. Here is how it was done. I created a counter called nopvc, which means no Pawn or capture, and set it to zero. Whenever a Pawn moved or a piece was captured, it got reset to zero. Otherwise, it got incremented by 1. In the post-game part, I compared its value with 50. This is done after checkmate and stalemate are checked for just in case the 50th move resulted in a checkmate.
Also, I realized I was using a global variable for posvar in the code for enforcing three-times repetition. So I removed the code in the post-game part for computing the value of posvar. The value it needs to be has already been set the last time posvar was given a value.