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
626 stars 196 forks source link

Support multi threaded chess #825

Open HKalbasi opened 2 months ago

HKalbasi commented 2 months ago

I found a new chess variant, I don't know if it is a well-known variant or not, but I played it sometimes with my friends and it leads to very interesting situations and complex mate in 1 and mate in 2s so I would really like to see it being supported by fairy stockfish.

The idea is very simple. The rules are same as normal chess, except that each piece has its own identity or thread, and in a single move, each piece can do something independent of other pieces. Every piece move should be valid in the board without any actions (so you can't open the way of a piece and move it in a single move) and no two piece can end up in a single square. This could be an opening:

|r|n|b|q|k|b|n|r|
|p|p|p|p|p|p|p|p|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|P|P|P|P|P|P|P|P|
|R|N|B|Q|K|B|N|R|

1. a4 b4 c4 d4 e4 f4 g4 h4 Nc3 Nf3 - ..

Note that no other piece can make a move here

|r|n|b|q|k|b|n|r|
|p|p|p|p|p|p|p|p|
| | | | | | | | |
| | | | | | | | |
|P|P|P|P|P|P|P|P|
| | |N| | |N| | |
| | | | | | | | |
|R| |B|Q|K|B| |R|

1. .. - d5 e5 c6 f6

|r|n|b|q|k|b|n|r|
|p|p| | | | |p|p|
| | |p| | |p| | |
| | | |p|p| | | |
|P|P|P|P|P|P|P|P|
| | |N| | |N| | |
| | | | | | | | |
|R| |B|Q|K|B| |R|

Then white can capture two pawns simultaneously, and so on.

Checkmate happens when the king can't avoid being captured on the next move. Note that the king can avoid the checkmate with the help of another piece. For example:

|R| | |k| | | | |
| | | | | | | |R|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | |r|
| | | | | | | | |
| | | | | | | | |

Is a checkmate in a normal chess, but in the multi threaded chess, rook can capture the rook and king can avoid the check by going down at the same time, so it is not a check mate.

Multi threaded mode is not specific to chess and a multi threaded shogi, bughouse, antichess and similar are imaginable. Is it possible to implement multi threaded mode in a general way in fairy stockfish?