Conversation
A double ron in red_mahjong was settled one winner at a time. The first RON was paid, took the riichi sticks and went into the action history before the next player who could ron the same tile had answered, so that player decided knowing whether the first had won, and for how much. On a 三家和 the third player saw two wins booked and could void both with a RON. _ron now keeps each RON in pending_rewards and pending_winners, and _settle_ron pays them all, clears the sticks and records the RONs, in the order they were asked, on the step that closes the window: the last candidate's RON or PASS. A 三家和 has paid nothing, so there is nothing to roll back, and pending_kyotaku is removed. A window closed by a PASS now keeps target and leaves the turn with the last winner, as one closed by a RON did, so it no longer shows that someone declined. In both envs a player who could ron and pon (or chi) a discard was offered the pon only when nobody else could ron (or pon) it, so the prompt told them about another player's hand. In a double ron it also told the second candidate what the first did: after a RON only the RON column is kept, after a PASS the whole row. A player who can ron now always answers RON or PASS first; a declined ron leaves the pon or chi, offered once the higher claims are answered. A RON also leaves the rows in players.legal_action_mask exactly as a PASS does, so a candidate's own stored row does not show it either. New tests in tests/red_mahjong/test_ron_window.py and no_red's test_env start from real discards and an added kan, and compare a later candidate's observation, offered mask and stored rows after each way the earlier ones can answer. The lower-call tests of both envs and red's _claims_open_to, double-ron and triple-ron tests pinned the old behavior and are updated.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things let a player learn, from what the env offered them, what the other players could do or had done with the same discard.
1. A double ron was settled one winner at a time
In
red_mahjongthe first RON was paid, took the riichi sticks and went intoaction_historybefore the next player who could ron the same tile had answered. That player decided knowing whether the first had won, and for how much, ura dora included. On a 三家和 the third player saw two wins booked and could void both with a RON. This is the known limitation in the v0.1.6 release notes._ronnow keeps each RON inpending_rewardsandpending_winners, and_settle_ronpays them all, clears the sticks and records the RONs, in the order they were asked, on the step that closes the window: the last candidate's RON or PASS. A 三家和 has paid nothing, so there is nothing to roll back, andpending_kyotakuis removed. A window closed by a PASS keepstargetand leaves the turn with the last winner, as one closed by a RON does, so the closed round does not show that someone declined.2. The offered calls depended on the other players' hands
In both envs,
_claims_open_tooffered a player who could ron and pon (or chi) a discard the pon only when nobody else could ron (or pon) it, so the prompt told them about another player's hand. In a double ron it also told the second candidate what the first did: after a RON only the RON column was kept, after a PASS the whole row.A player who can ron now always answers RON or PASS first; a declined ron leaves the pon or chi, offered once the higher claims are answered, as #87 already did when claims competed. A RON also leaves the rows in
players.legal_action_maskexactly as a PASS does, so a candidate's own stored row does not show it either.Behavior changes
action_history, and ron payments enterscoreandrewards, only on the step that closes the window.red_mahjong'sEnvState,pending_kyotakuis removed andpending_winnersis added.no_red_mahjonghas no multiple ron and no such fields.Tests
tests/red_mahjong/test_ron_window.py, starting from real discards and an added kan:autoanddummy_share;no_red: a ron candidate is offered the same calls whoever else can claim the tile._claims_open_to, double-ron and triple-ron tests.main; the 2 that pass guard unchanged riichi behavior. Full suite: 334 passed, 2 skipped.Tested on CPU with Python 3.12 and JAX 0.11.1, using the CI command (visualization tests excluded).