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

How to implement games with interruptions #979

Closed
rezunli96 opened this issue Dec 20, 2022 · 5 comments
Closed

How to implement games with interruptions #979

rezunli96 opened this issue Dec 20, 2022 · 5 comments

Comments

@rezunli96
Copy link
Contributor

rezunli96 commented Dec 20, 2022

Hi. In some card games (e.g., UNO, Mahjong), when a player plays a certain hand, then it is possible for another player to interrupt, do some action, and become the next player. Usually if multiple players interrupt it is the first one who shouted becomes the next player.

But I think it is hard to implement in OpenSpiel as it has a real-time flavor. I can see one feasible solution is to determine some pre-fixed round robin order and ask each player whether it wants to interrupt.

Another possible solution might be to implement it as a simultaneous node. And for those who choose to interrupt just randomly decide who is the next player.

But these may not be perfectly satisfactory as they may change the vanllia game mechanic.

I wonder was there a similar situation for the existing implemented games? And what were their solutions?

@lanctot
Copy link
Collaborator

lanctot commented Dec 23, 2022

Magic: The Gathering would be another example (but I didn't think UNO would be?)

The only way I see this being feasible is as you say: some kind of regular prompt to ask if the others want to interrupt. I like the idea of a simultaneous node to avoid the round-robin querying of the players.

I agree it's not the best solution and ideally there would be some for of support for real-time games.

There are no games in OpenSpiel of this form, currently. Is this coming up in Mahjong? Can you give an example of a situation where it occurs that you're currently trying to figure out? Because if it's in Mahjong, that game has been used for AI before and then OpenSpiel could adopt what is commonly done in the Mahjong engines to address this.

@rezunli96
Copy link
Contributor Author

Oh for UNO I just checked wikipedia, turns out yes the official rule doesn't have interruption, while there is a jump-in rule in some house-rule.

Wow that makes implementing UNO much easier than I thought! I think I am also interested in implementing UNO now, if there isn't a copy-right related issue?

In riichi Mahjong for example (I think it also applies to most of the Mahjong versions), if a player discards a tile, then the other players can call and claim this tile to form a "group" (part of the winning hand it wants to have). For certain group category like Pon, I think it is the first one shouted claim the tile.

Not sure how the current engine did. My guess is they also have a real-time flavor. The AI decides whether to call or not if such an option is presented at the current step. But it might happen that an AI called at its end, but got preempted by another player. Some implementation I read seems to use a two-phase commitment-like protocol (the players first purpose their calling action, and then one of them will get executed eventually). An example is in Section 2.1 of this paper

@lanctot
Copy link
Collaborator

lanctot commented Dec 26, 2022

UNO is a commercial game still sold widely in stores, so it'd be best to ask for permissions.

However it is quite similar to Crazy Eights, so I'd suggest implementing that one instead.

@rezunli96
Copy link
Contributor Author

Ok, I will take a look at Crazy Eights. Thanks!

@lanctot
Copy link
Collaborator

lanctot commented Mar 27, 2023

Closing due to inactivity. Please re-open if you want to continue the discussion.

@lanctot lanctot closed this as completed Mar 27, 2023
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

2 participants