Russ-- a couple of things.
1. Thanks for trying to implement this. It will be a great feature.
2. I have concerns about the way it works right now. According to the official rules, a draw for threefold repetition can only be claimed immediately after it occurs. The rules say:
___________
10.10
The game is drawn, upon a claim by the player having the move, when the same position, for the third time:
(a)
is about to appear, if he first writes the move on his scoresheet and declares to the arbiter his intention of making this move; or
(b)
has just appeared, the same player having the move each time.
The position is considered the same if pieces of the same kind and colour occupy the same squares, and if all the possible moves of all the pieces are the same, including the rights to castle [at some future time] or to capture a pawn "en passant".
10.11
If a player executes a move without having claimed a draw for one of the reasons stated in Article 10.10, he loses the right to claim a draw. This right is restored to him, however, if the same position [later] appears again, the same player having the move. "
________
The stipulation in Article 10.11 seems important to me, because if a draw can be claimed at any time, by either player, after a threefold repetition has occurred, this will mean that either player can immediately bail out of a game that takes a turn for the worse and come out with a draw.
In other words, once I spot a repetition, I have the power to end the game whenever I feel like it, be it one move or thirty moves down the road. I don't think this is good. So if there's some way you could make the repetition draw claimable only on the move it occurs or the move after, that would be great.