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

[Sittuyin] promotion rule #14

Closed
teakado opened this issue Dec 20, 2018 · 9 comments
Closed

[Sittuyin] promotion rule #14

teakado opened this issue Dec 20, 2018 · 9 comments
Labels
bug Something isn't working
Milestone

Comments

@teakado
Copy link

teakado commented Dec 20, 2018

Thank you for adding Sittuyin support!

I finally had a chance to do some testing, mainly by using some highly artificial positions to test rule conformity during promotion. The testing methodology was simple, involving obvious and enticing material incentives, to encourage promotion as long as the engine thinks it is legal to do so.

I am happy to report that the current master branch seems to know most of the rules, although it still appears to be ignoring one: "The promotion shall not be made in the direct-attacking position to the opponent piece by newly-promoted general." (rule 3.9 c.4, page 8)

Specifically, it would try to promote with a fork on non-King pieces. But if the same move also attacks the opponent King, the engine knows about the "no checks, direct or discovered" rule, and avoids it.

8/8/4r1r1/6fk/1R2P3/4N3/2N5/2KS4 w - - 0 1
PV: e4f5f (illegal attack forking two rooks with the new Fers)

But if the opponent King is also involved, a similar fork isn't attempted.
8/8/4r1k1/6fr/1R2P3/4N3/2N5/2KS4 w - - 0 1
PV: e4e4f (legal promotion)

P.S.
I just realized that this might not be a bug, and probably a different interpretation that you made from the wording of the rules. But because this could potentially affect game-play, especially in positions where the engine might be relying on (or trying to avoid) variations which include winning/regaining material with forks upon promotion, I thought I'd report about this behavior. Thank you!

@ianfab
Copy link
Member

ianfab commented Dec 20, 2018

Thanks for the thorough testing. My interpretation of this rule was that you may not capture by a promotion, since there does not seem to be any other paragraph stating something about this, but I agree that the wording rather indicates your interpretation of the rule. In cutechess and pychess these kind of attacking promotions also do not seem to be excluded, so @alwey and @gbtami might also be interested in this discussion.

One rule I definitely have not implemented yet is c.7, since claiming a draw by not making a move in a position where there are legal moves would require to add something like a passing move. Since this situation should be very rare, it does not have a high priority for me at the moment.

If you want to check whether the engine considers a move to be legal, you can also use perft (only via the command line, not in a GUI) instead of doing a search. E.g.:

setoption name UCI_Variant value sittuyin
position fen 8/8/4r1r1/6fk/1R2P3/4N3/2N5/2KS4 w - - 0 1
go perft 1
info string variant sittuyin files 8 ranks 8 pocket 6 template fairy startpos 8/8/4pppp/pppp4/4PPPP/PPPP4/8/8[KFRRSSNNkfrrssnn] w - - 0 1
e4e5: 1
e4d3f: 1
e4f3f: 1
e4e4f: 1
e4d5f: 1
e4f5f: 1
e3f1: 1
e3g2: 1
e3c4: 1
e3g4: 1
e3d5: 1
e3f5: 1
c2a1: 1
c2e1: 1
c2a3: 1
c2d4: 1
b4b1: 1
b4b2: 1
b4b3: 1
b4a4: 1
b4c4: 1
b4d4: 1
b4b5: 1
b4b6: 1
b4b7: 1
b4b8: 1
d1d2: 1
d1e2: 1
c1b1: 1
c1b2: 1
c1d2: 1

Nodes searched: 31

@gbtami
Copy link
Member

gbtami commented Dec 20, 2018

@teakado thx a lot! Seems we all missed rule 3.9 c.4.

@alwey
Copy link
Contributor

alwey commented Dec 20, 2018

I was aware of this rule, and I interpreted it as prohibition to capture pieces by promotion.

I tried to interpret c.4 in relation to c.2 and c.5

ianfab added a commit that referenced this issue Mar 4, 2019
Taking a promotion to avoid stalemate is optional (rule 3.9 c.7).

Example:
setoption name multipv value 20
setoption name UCI_Variant value sittuyin
position fen k5PK/3r4/8/8/8/8/8/8 b - - 0 1
go depth 1

No functional change for other variants.
@ianfab
Copy link
Member

ianfab commented Mar 4, 2019

Since it is working as intended, I do not consider this a bug unless there is more evidence on how to interpret the wording of this rule. The rule 3.9 c.7 is also implemented now, so the Sittuyin rules should be completely supported.

If you encounter more unexpected behavior, feel free to re-open this or create a new issue.

@ianfab ianfab closed this as completed Mar 4, 2019
@ianfab ianfab added the won't This will not be worked on label Mar 4, 2019
ianfab added a commit that referenced this issue Aug 5, 2019
ianfab pushed a commit that referenced this issue Feb 9, 2020
Fix insufficient material adjudication for shako
@ianfab
Copy link
Member

ianfab commented Apr 23, 2020

Reopening this due to new evidence regarding the interpretation of the rules, with answers provided by an arbiter: https://www.facebook.com/Myanmar-Sittuyin-105323654491347/

Summary:

  • Promotions giving direct or discovery checks are prohibited
  • Promotions that cause the promoted piece to attack an opponent's piece are prohibited
  • Pawns that are allowed to promote do not attack the squares diagonally behind them (as the promotion can not capture), i.e., the opponent's king is allowed to move there.

@ianfab ianfab reopened this Apr 23, 2020
@ianfab ianfab added bug Something isn't working and removed won't This will not be worked on labels Apr 23, 2020
@ianfab ianfab added this to the v11.1 milestone Apr 23, 2020
@ianfab ianfab closed this as completed in c55fea6 Apr 24, 2020
@ianfab
Copy link
Member

ianfab commented May 23, 2020

@alwey What is your opinion on changing this in cutechess as well? Shall I open an issue for it in the cutechess repo?

@alwey
Copy link
Contributor

alwey commented Jun 18, 2020

@ianfab Sorry for my comment being late.
Is following interpretation correct?

Promotions can neither capture nor give direct check (already implemented in cutechess).
Promotions cannot give discovered check (already implemented).
Promotions must not threaten to capture opponent pieces directly.

The last aspect needs implementation in cutechess.

@ianfab
Copy link
Member

ianfab commented Jun 18, 2020

@alwey Yes, this interpretation is correct. Also see the adjusted perft tests in the above commit for testing:
c55fea6#diff-79bc3d3d71d47c26c0606c8cdd8f2627L60-R62

@alwey
Copy link
Contributor

alwey commented Jun 18, 2020

Great, thank you! I just made a change to SittuyinBoard::vIsLegalMove. All of the referenced perft values match. I am going to push a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants