Longhorn-Riichi / InjusticeJudge

Announce to the world why your Mahjong Soul/tenhou.net/Riichi City losses are unjustified
2 stars 3 forks source link

Iishanten type detection bug #22

Closed peter1357908 closed 11 months ago

peter1357908 commented 11 months ago

Unit test game:

# double houtei ron (long game)
"https://tenhou.net/4/?log=2023052010gm-000b-18940-a4d57844",
Traceback (most recent call last):
  File "/home/peter/Ronhorn/./test_injustice.py", line 50, in <module>
    asyncio.run(test_links())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/peter/Ronhorn/./test_injustice.py", line 47, in test_links
    print(await analyze_game(link))
  File "/home/peter/Ronhorn/ext/InjusticeJudge/utilities.py", line 42, in analyze_game
    kyokus, game_metadata, player = await parse_game_link(link, specified_player)
  File "/home/peter/Ronhorn/ext/InjusticeJudge/utilities.py", line 27, in parse_game_link
    kyokus, parsed_metadata = parse_tenhou(tenhou_log, metadata)
  File "/home/peter/Ronhorn/modules/InjusticeJudge/injustice_judge/fetch.py", line 795, in parse_tenhou
    return postprocess_events(all_events, parsed_metadata), parsed_metadata
  File "/home/peter/Ronhorn/modules/InjusticeJudge/injustice_judge/fetch.py", line 103, in postprocess_events
    kyoku.hands[seat] = kyoku.hands[seat].remove(tile)
  File "/home/peter/Ronhorn/modules/InjusticeJudge/injustice_judge/classes.py", line 160, in remove
    return Hand(tuple(tiles), [*self.calls], prev_shanten=self.shanten, kita_count=self.kita_count)
  File "<string>", line 11, in __init__
  File "/home/peter/Ronhorn/modules/InjusticeJudge/injustice_judge/classes.py", line 136, in __post_init__
    super().__setattr__("shanten", calculate_shanten(self.hidden_part))
  File "/home/peter/Ronhorn/modules/InjusticeJudge/injustice_judge/shanten.py", line 357, in calculate_shanten
    return _calculate_shanten(tuple(sorted(remove_red_fives(starting_hand))))
  File "/home/peter/Ronhorn/modules/InjusticeJudge/injustice_judge/shanten.py", line 306, in _calculate_shanten
    assert shanten != 1, f"somehow failed to detect type of iishanten for iishanten hand {ph(sorted_hand(starting_hand))}"
AssertionError: somehow failed to detect type of iishanten for iishanten hand <:1m:1142707135021600830><:2m:1142707491713593355><:2m:1142707491713593355><:3m:1142707570251939880><:6m:1142707574119079936><:7m:1142707575108931665><:8m:1142707576740520006><:3s:1142707991351672982><:3s:1142707991351672982><:4s:1142707992580603914><:6s:1142986859488751646><:8s:1142986885195640972><:8s:1142986885195640972>
EpicOrange commented 11 months ago

fixed some time ago