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

An exception in mjai.app. #58

Open
constellation39 opened this issue Sep 18, 2023 · 1 comment
Open

An exception in mjai.app. #58

constellation39 opened this issue Sep 18, 2023 · 1 comment

Comments

@constellation39
Copy link

I compiled the mjai.app using the develop branch and deployed it at https://mjai.app/.
During one round of execution, I encountered the following error:

Traceback (most recent call last):
  File "/workspace/bot.py", line 12, in <module>
    main()
  File "/workspace/bot.py", line 8, in main
    kanachan.run()
  File "/workspace/_kanachan.py", line 2220, in run
    self.__on_peng(message)
  File "/workspace/_kanachan.py", line 1933, in __on_peng
    raise RuntimeError(peng)
RuntimeError: ('5s', ('5s', '5sr'))

I added the following code to fix the issue:

if consumed == tuple(['5m', '5mr']):
    consumed = tuple(['5mr', '5m'])
elif consumed == tuple(['5p', '5pr']):
    consumed = tuple(['5pr', '5p'])
elif  consumed == tuple(['5s', '5sr']):
    consumed = tuple(['5sr', '5s'])

I'm not sure if I should proceed this way, so I opened up this issue.

@shinkuan
Copy link

shinkuan commented Sep 18, 2023

I think it can be solved also by changing _NUM2PENG values.

_NUM2PENG = (
('1m', ['1m', '1m']),
('2m', ['2m', '2m']),
('3m', ['3m', '3m']),
('4m', ['4m', '4m']),
('5m', ['5m', '5m']),
('5m', ['5mr', '5m']),
('5mr', ['5m', '5m']),
('6m', ['6m', '6m']),
('7m', ['7m', '7m']),
('8m', ['8m', '8m']),
('9m', ['9m', '9m']),
('1p', ['1p', '1p']),
('2p', ['2p', '2p']),
('3p', ['3p', '3p']),
('4p', ['4p', '4p']),
('5p', ['5p', '5p']),
('5p', ['5pr', '5p']),
('5pr', ['5p', '5p']),
('6p', ['6p', '6p']),
('7p', ['7p', '7p']),
('8p', ['8p', '8p']),
('9p', ['9p', '9p']),
('1s', ['1s', '1s']),
('2s', ['2s', '2s']),
('3s', ['3s', '3s']),
('4s', ['4s', '4s']),
('5s', ['5s', '5s']),
('5s', ['5sr', '5s']),
('5sr', ['5s', '5s']),
('6s', ['6s', '6s']),
('7s', ['7s', '7s']),
('8s', ['8s', '8s']),
('9s', ['9s', '9s']),
('E', ['E', 'E']),
('S', ['S', 'S']),
('W', ['W', 'W']),
('N', ['N', 'N']),
('P', ['P', 'P']),
('F', ['F', 'F']),
('C', ['C', 'C'])
)

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