Open wgreenberg opened 3 years ago
I wrote a python program playing Hive a while ago. To initiate a draw i used the 3-fold board repetition rule, as in Chess. That is, if the same board position appears three times in the same game, the game ends automatically with a draw. This prevents local stalemates, where players keep repeating the same moves because there's no other feasible option. It is a piece of code easy to implement if the original code keeps track of board history.
Threefold repetition sounds like a good benchmark for automated draws, but I do still think there's a case for a voluntary draw. I've only played a bit of hive, but already I've run into an instance where me and my opponent very nearly agreed to a draw.
Threefold repetition sounds like a good benchmark for automated draws, but I do still think there's a case for a voluntary draw. I've only played a bit of hive, but already I've run into an instance where me and my opponent very nearly agreed to a draw.
The Trainer has code to check the "threefold repetition" rule for automatic draws when playing AI vs AI battles.
The UHP does have the provision for the GameStateString "Draw", so engines can determine that the game is drawn and a viewer should be able to handle that. However MzingaEngine does not ever decide there's a Draw unless a move is played which surrounds both Queens. But there's no reason why an Engine couldn't implement the repetition rule if it wanted to. Maybe I'll add it as an option for the Engine. It would definitely impact the search tree of the AI though.
As for being able to voluntarily draw, the only reason I can see is to facilitate tournament play, where an unedited record of the game is being generated and submitted for records. Otherwise MzingaViewer lets you save games and set the the result as a draw.
I have no idea what the AI would look like for proposing/accepting/rejecting a draw. I'm not even sure if chess engines handle that.
I've been writing an engine implementing UHP, but have a question regarding how draws are handled. In a two player game, a draw can either happen due to a single move surrounding both queens, or because both players agree to a draw. The former case is pretty straightforward to implement, but the latter doesn't seem to be supported by UHP. Regardless of the play scenario (PvP, PvAI, AIvAI), I can see a use case for supporting voluntary draws.
Perhaps adding some new commands (e.g.
proposedraw
acceptdraw
rejectdraw
) that don't update the board state could facilitate this?p.s. I really appreciate the work you've put into this!