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

Shogi Impasse rules #450

Open
msomatt opened this issue Mar 22, 2022 · 6 comments
Open

Shogi Impasse rules #450

msomatt opened this issue Mar 22, 2022 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@msomatt
Copy link

msomatt commented Mar 22, 2022

Shogi has some uncommon 'Impasse' rules, which lishogi have implemented and explained here:
https://lishogi.org/explanation/impasse

Is it possible to have impasse evaluated for Shogi in Fairy-Stockfish? As an 'Optional Game End' would seem sensible.

@ianfab ianfab added the enhancement New feature or request label Mar 22, 2022
@ianfab
Copy link
Member

ianfab commented Mar 22, 2022

Thanks for the suggestion. I think this should be doable, considering that these rules are very clear and do not require any arbiter judgement.

Do you by chance know how impasse works in handicap games or shogi variants? By design of Fairy-Stockfish I always try to make features work as generically as possible to make them easier to reuse, so would be good if the rules could be generalized. E.g., 27 is just half of the total points, but if 27 even applies in handicap games then there is no way to implicitly derive this threshold from the position but has to be hard-coded. For the 10 pieces rule I do not know the exact reasoning. Is this just a threshold from experience when the king can be considered safe? Or does this equal the number of non-pawn pieces (10) or exceed the number of pawns (9)? If you have any info regarding these points, please let me know.

@msomatt
Copy link
Author

msomatt commented Mar 22, 2022

I can't say that I do know the answers to your questions, but I shall ask around.

@msomatt
Copy link
Author

msomatt commented Mar 23, 2022

I do however have a list of moves that should produce an impasse situation in regular Shogi:
"c3c4", "g7g6", "b2h8+", "b7b6", "b3b4", "b6b5", "b4b5", "b8b5", "h3h4", "b5b1+", "h4h5", "b1a1", "h5h6", "a1c1", "h6h7+", "c1d1", "e1f2", "d1f1", "f2f1", "g6g5", "h8i9", "g5g4", "i9h9", "g4g3+", "h9g9", "i7i6", "h7h8", "g3g2", "f1g2", "e7e6", "g2g3", "e6e5", "g3f4", "e5e4", "f4e4", "f9g8", "e4e5", "g8g7", "e5e6", "g7g6", "e6e7", "f7f6", "h2h7+", "g6g5", "g1g2", "i6i5", "g2g3", "i5i4", "g3g4", "i4i3+", "g4g5", "d9c8", "g5g6", "c8b7", "g6g7+", "b7b6", "i1i3", "c9b8", "i3i7+", "b6b5", "R@i9", "b5b4", "B@i8", "b4b3", "G@h9", "b8b7", "P@b8", "b7b6", "N@b7", "f6f5"
Which is the same moves as this game on lishogi:
https://lishogi.org/RLM06DQB

@ianfab
Copy link
Member

ianfab commented Mar 23, 2022

Thanks, that can be useful for testing.

In the meantime I found a statement on https://en.wikipedia.org/wiki/Handicap_(shogi)#Rules saying that

If a jishogi (持将棋 jishōgi "impasse") occurs in a handicap game, the removed pieces are counted towards White's total.

@msomatt
Copy link
Author

msomatt commented Mar 23, 2022

I have also been pointed to the following link which agrees with Wikipedia:

All other rules stated so far basically do not change even in handicaps. In point rules in King Entering, however, the points for the removed pieces are added to the handicap giver’s points.

'King Entering' is Impasse. And the player giving the handicap is always 'White'.
http://81dojo.com/documents/Rules_and_Manners_of_Shogi#Handicaps

@ianfab
Copy link
Member

ianfab commented Mar 29, 2022

For later reference I just add a few more links:
https://github.com/yaneurao/YaneuraOu/blob/405b6bfb97a7177a3e375068838986fa7322fc10/docs/USI%E6%8B%A1%E5%BC%B5%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89.txt#L94-L108
https://github.com/yaneurao/YaneuraOu/blob/4d1d0f6cef241685383a54ca2794d3f24cf80a70/source/position.cpp#L2106-L2186

One topic I was also wondering about, namely whether in case of handicap the handicap giver is considered to be the first or second player (i.e., needs 28 or 27 points) seems to be controversial if I understand (the machine translation) correctly:
https://yaneuraou.yaneu.com/2021/09/14/yaneuraou-is-losing-too-much-to-aobazero/

@ianfab ianfab added this to the next milestone Apr 1, 2022
@ianfab ianfab self-assigned this Apr 24, 2022
@ianfab ianfab removed their assignment May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants