Two-players chess game
Motivation
This example is a simple user interface that is used in the tutorials section to introduce hierarchical machines. Aside from that, it showcases how the reuse of battle-tested components (ChessBoard
component for displaying a chess game, chess.js
library to handle the game itself) allows the machine to focus only on the UI logic.
Among the learnings from the example are:
- use of the
settings
parameter for dependency injection (chess engine) - use of history states
- you can do effects in the state machine if you immediately cancel them so that those effects are invisible from outside the machine