Hey @shoemakerlevy9, cool project
In terms of the state machine, here are some resources that might be of interest: