Wrapping Up
We’ve done a lot of great work in this chapter. We’ve built a state machine from scratch, encapsulating all the rules of Islands with a data structure and a handful of clauses for a single function.
Along the way, you learned a lot about finite state machines in general. You saw how to map events to states in order to make decisions about behavior. You learned how to manage state and state transitions.
The implementation we came up with is completely decoupled from any of the other modules we’ve written so far. It can decide whether actions follow the rules independently, without any knowledge of the application logic for the rest of the game.
Now we’re ready to put all the work we’ve done so far together in a single entity, with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access