fairy-stockfish / Fairy-Stockfish

chess variant engine supporting Xiangqi, Shogi, Janggi, Makruk, S-Chess, Crazyhouse, Bughouse, and many more
https://fairy-stockfish.github.io/
GNU General Public License v3.0
606 stars 189 forks source link

Kakao janggi has 2 types of repetition rules. #198

Closed cjssh1002 closed 3 years ago

cjssh1002 commented 3 years ago

Kakao janggi has 2 types of repetition rules. I explain to you the repetition rule. I hope you apply this rule to the FS-engine(modern).

*A: counter position of Repeat

  1. First repetition rule: B-A 1 time, C-A 2 times
  2. 3rd repetition rule: B-A 3 times
    • Can be : B-A 2 times, C-A 1 time

No.2 has already been applied. However, No.1 has not yet been applied.

ianfab commented 3 years ago

Thanks. If I understand correctly, A/B/C refer to positions, not moves, so does this mean the repetition detection in Kakao Janggi is based purely on positions, and not on moves? If this is the case, that would simplify matters for me.

Currently, repetition detection in Fairy-Stockfish is purely based on the reoccurrence of a single position, so it does not matter how many other positions occur in between or in which order. Therefore it does not depend on being a straightforward back-and-forth movement pattern with positions repeating like A-B-C-D-A-B-C-D-A or the like.

If this does not cover the scenario you are referring to, can you please explain it in more detail? I am not sure yet whether A/B/C in your patterns above refer to moves, positions, or positions with the same side to move.

cjssh1002 commented 3 years ago

Exactly, it is based on the order of positions. Any repetition other than this are not included in the scenario.

ianfab commented 3 years ago

Summary from a discussion on discord on the criteria for prohibiting a repetition in Kakao Janggi:

ianfab commented 3 years ago

@cjssh1002 I tried to implement the above rules in https://github.com/ianfab/Fairy-Stockfish/commit/cabb1f562092235e53c3f755a503c903816144c0 and it seems to work, but I did not have much time to test it yet. If you like to test it already, feel free to do so. Feedback would be very welcome. The rule is only applied for the janggimodern variant.

cjssh1002 commented 3 years ago

I forgot about the only 1 rules.

Even if use "pass" during the repeat, the repeat counter is maintained. (When passing after 2 repetitions) This means that a new counter will not start after the "pass".

ianfab commented 3 years ago

Update:

cjssh1002 commented 3 years ago

Yes it is correct.

ianfab commented 3 years ago

I tried to fix the reported issues, please have another look: https://github.com/ianfab/Fairy-Stockfish/commit/bee163eabaeec25ef84c25e0fbc492632e762cc7

cjssh1002 commented 3 years ago

You must be tired. Thank you for your effort. ^_^ Now me and my janggi cafe members will fully test for the official master merge.

cjssh1002 commented 3 years ago

There is rule that needs to be modified. This is a kakao janggi rule that i was very hard to find.