WandererXII / lishogi

☗ lishogi.org: the forever free, adless and open source shogi server forked from lichess.org ☗
https://lishogi.org
GNU Affero General Public License v3.0
259 stars 39 forks source link

Chu Shogi counter-strike rule not invoked on the second part of a multi-move #846

Open amdewitt opened 1 week ago

amdewitt commented 1 week ago

Exact URL where the bug happened - Example Position at:

https://lishogi.org/analysis/chushogi/lfcsgekgscfl/a1b1txot1b1a/mvrhdqn2rvm/ppppp1p1pppp/3i+D1+Hp4/12/12/4P+h1+dI3/PPPP1P1PPPPP/MVR2NQDHRVM/A1B1TOXT1B1A/LFCSGKEGSCFL%20b%20-%2017

Steps to reproduce the bug

  1. Go to the above URL.
  2. Capture Gote's Lion with one of Sente's provided Birds (Falcon/Eagle). The exact way you capture does not matter. 2a. Upon doing this, you should see the counter-strike rule properly invoked when clicking Gote's provided Falcon or Eagle for the first time.
  3. Move one of Gote's provided Birds (Falcon/Eagle) to the square immediately before the opposing Lion (so that it can be moved again), then click the moved piece again. 3a. Upon doing this, you should see that the counter-strike rule is not invoked, even though the game is still on the same turn.

What did you expect to happen? - After capturing a Lion on the last turn, capturing a Lion is not allowed during any part of the move.

What happened instead? - After capturing a Lion on the last turn, capturing a Lion with a Falcon or Eagle is allowed on the second part of a multi-move (but not for the first)

Explanation - My guess is that the developers simply forgot about the double moves of the Falcon and Eagle, and only added the counter-strike code for normal moves.

Fixing this bug shouldn't break any games, as Falcons and Eagles tend to appear toward the end of a game, and players will usually choose the most direct option to capturing a Lion. Furthermore, any player who makes the slightest effort to learn the rules before playing should know the Lion-trading rules.

Note - The precedent arising from Issue #830 is that non-Lion in the wording of the counter-strike rule means piece types, not move types. And since the non-Lion pieces include the Falcon and Eagle, this implies that the expected outcome should indeed happen, and the bug does need fixed.

Operating system and browser version - Any that supports Chu Shogi

Screenshot 2024-07-02 234811

WandererXII commented 1 week ago

Thank you very much for finding and reporting these issues. I will try to get the fix out today or tomorrow.