gbtami / pychess-variants

Chess variant server
https://www.pychess.org
GNU Affero General Public License v3.0
235 stars 114 forks source link

Invalid move error in Janggi game #956

Closed gbtami closed 2 years ago

gbtami commented 2 years ago

https://www.pychess.org/eA56PD6o

https://i.imgur.com/mtpAaEV.png

11 Jun 2022 18:08:01.626257 <190>1 2022-06-11T16:08:01.144777+00:00 app web.1 - - ERROR:fairy:ERROR: sf.get_fen() failed on rbna1anbr/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RNBA1ABNR w - - 0 1 e4e5,g10f8,h1g3,h8e8,e2e1,g7g6,b1c3,c10d8 False
11 Jun 2022 18:08:01.626155 <190>1 2022-06-11T16:08:01.144939+00:00 app web.1 - - ERROR:game:ERROR: Exception in game eA56PD6o play_move() c1e4
11 Jun 2022 18:08:01.626125 <190>1 2022-06-11T16:08:01.144941+00:00 app web.1 - - ValueError: Invalid move 'c1e4'
11 Jun 2022 18:08:01.62694 <190>1 2022-06-11T16:08:01.144941+00:00 app web.1 - -
11 Jun 2022 18:08:01.626162 <190>1 2022-06-11T16:08:01.144942+00:00 app web.1 - - The above exception was the direct cause of the following exception:
11 Jun 2022 18:08:01.62694 <190>1 2022-06-11T16:08:01.144942+00:00 app web.1 - -
11 Jun 2022 18:08:01.626128 <190>1 2022-06-11T16:08:01.144943+00:00 app web.1 - - Traceback (most recent call last):
  File "/app/server/game.py", line 338, in play_move
    self.board.push(move)
  File "/app/server/fairy.py", line 69, in push
    self.fen = sf.get_fen(
SystemError: <built-in function get_fen> returned a result with an exception set
Tech-Expert-Wizard commented 2 years ago

In fact, this "invalid move" error occurs a lot in tournaments for other variants, not just janggi. Apparently, whenever you go back to the previous move and then make a move, it gives this error. But, I just tried this (not in a tournament) and the error doesn't happen, so I think it only happens in tournaments. Reported in #981.

gbtami commented 2 years ago

Fixed via https://github.com/gbtami/pychess-variants/commit/655e3be5a6ee6d5e8652bd5329671a2f683627ba