This is a project to learn and explore Finite State Machines through the State Pattern. Managing complex state is challenging but it can be made easier by using state machines to manage states and transitions.
This example models ant behaviour as described in this article.
A Pen created at CodePen.io. You can find this one at https://codepen.io/KevinBradley/pen/MzmGmX.