-
Notifications
You must be signed in to change notification settings - Fork 13
Fix Simulator for west-round terminal states #196
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,12 @@ def get_next_state(self, jsonl_path: Path | str) -> dict | None: | |
| last_kyoku_riichi_count += 1 | ||
|
|
||
| if first_start_kyoku_event is None: | ||
| # There are terminal cases where Match returns only | ||
| # start_game/end_game without any kyoku in continue mode. | ||
| # Treat them as a clean finish, not a runtime error. | ||
| event_types = {event["type"] for event in events} | ||
| if event_types.issubset({"start_game", "end_game"}): | ||
| return None | ||
| raise RuntimeError("can't start game") | ||
| scores: list[int] = first_start_kyoku_event["scores"] # type: ignore | ||
| last_delta: list[int] = [0, 0, 0, 0] | ||
|
|
@@ -155,7 +161,9 @@ def get_next_state(self, jsonl_path: Path | str) -> dict | None: | |
| honba: int = last_start_kyoku_event["honba"] # type: ignore | ||
| kyotaku: int = last_start_kyoku_event["kyotaku"] # type: ignore | ||
| oya: int = last_start_kyoku_event["oya"] # type: ignore | ||
| if bakaze != "E" and kyoku >= 4: | ||
| # 南1局 → `4` のようにゼロ基準の値に変換する | ||
| zero_indexed_kyoku = kyoku_to_zero_indexed_kyoku(bakaze, kyoku) | ||
| if zero_indexed_kyoku >= 7: | ||
|
Comment on lines
+164
to
+166
|
||
| # オーラス | ||
| # - 親の delta が positive かつ 1位なら終了 (True) | ||
| # - 親の delta が 0 以下なら終了 (True) | ||
|
|
@@ -164,9 +172,6 @@ def get_next_state(self, jsonl_path: Path | str) -> dict | None: | |
| if last_delta[oya] <= 0: | ||
| return None | ||
|
|
||
| # 南1局 → `4` のようにゼロ基準の値に変換する | ||
| zero_indexed_kyoku = kyoku_to_zero_indexed_kyoku(bakaze, kyoku) | ||
|
|
||
| # 親の連続か否か | ||
| if last_delta[oya] > 0: | ||
| return { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
event_types.issubset({"start_game", "end_game"})is alsoTruefor an incomplete log that contains onlystart_game(or even an emptyeventslist), which would be treated as a clean finish and could mask real failures. Consider requiring thatend_gameis actually present (e.g., check thatevent_types == {"start_game","end_game"}or at least that both types exist) before returningNone.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
指摘ありがとうございます!
get_next_state()が呼ばれる条件を精査します。