1

In Corona times, it is not so easy to train children over the board. When that was possible, we used a lot of mini games with fewer pieces and most of the times a different goal. To bring those mini games online is not so easy, due to many factors:

  • Known chess libraries like chess.js (the most used Javascript library for chess) only allows standard games and does not support mini games.
  • Chess online sites like lichess.org have their set of games possible, and it is not at all easy to expand that.
  • Children should have a very simple web interface to start a game, play it, ...

So I am thinking about creating something myself. I am sure I can come up with a simple web application to register, pair players, ..., but the hardest part (for me) is to check that the rules of chess are met. But this set of rules is not fixed. Here are some examples

  • Some mini games don't have kings at all. This is not allowed in standard chess.
  • Some mini games treat the kings like normal pieces, so there is no chess, or even kings can be beaten.
  • Some mini games define the end of the game when the first piece is beaten. Or a pawn is promoted.
  • One variant I know has as rule that knight moves as knight, but captures as bishop, and vice versae.
  • Some mini games are played on different sized boards.
  • Some place pieces, that are not allowed to moved and / or captured.

What I am looking for is a library (preferred Javascript) that allows to add easily additional rules, and define for each game which rules are mandatory. Do you have recommendations about this?

1 Answer 1

2

Fairy-Stockfish supports configuration of chess variants at runtime, and it also has bindings for Python (pyffish) and Javascript (ffishjs) which can be used as libraries for chess variant game logic. E.g., PyChess has very few game logic built in, and uses both bindings in backend and frontend for the variant rules.

If you do not want to build something on your own, ChessCraft might be an alternative to be able to define and play variants directly in a UI.

2
  • Thank you a lot for providing that reference. I was not aware that there exist Fairy-Stockfish, and the Javascript compilation seems to be what I need. I will give it a try, but this seems to be a nearly perfect fit.
    – mliebelt
    Nov 28, 2020 at 16:11
  • I had a more detailed look, and boy, that is complicated. I am not sure that using ffish i with Javascript bindings is the way to go. But I don't expect any better tip, therefore I will accept the answer. What is difficult for me: possible to use in the browser?; bloated library with way more functionality than I need (other strategic games, engine, ...); API does not fit best, but should work; configuration in file. But plus is: configuration rules explicit (to learn and steal from); sufficient interface for playing.
    – mliebelt
    Nov 29, 2020 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.