Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Procedure for initiating a draw? #94

Open
wgreenberg opened this issue Nov 3, 2020 · 3 comments
Open

Procedure for initiating a draw? #94

wgreenberg opened this issue Nov 3, 2020 · 3 comments

Comments

@wgreenberg
Copy link

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!

@Cesco84
Copy link

Cesco84 commented Nov 4, 2020

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.

@wgreenberg
Copy link
Author

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.

@jonthysell
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants