07 Mission Instructions
2. About Finite State Machines
As robots seek to solve more complicated problems, the computer programs that control them also need to become more complex. One big idea that programmers and engineers use to solve many problems is a finite state machine.
A finite state machine is a way of keeping track of a system using different snapshots over time. Your program will model a machine that changes its own state based on events happening around it (whether the lights are on or off).
The important thing to know about state machines is that they only notice if something has changed, not necessarily what exactly changed about it. So in the program we will write today, our program will look to see if the light sensor is receiving the same values as it was the last time we checked on it.
Fun fact: finite state machines aren’t just for light bulbs - they can also keep track of much more complicated inputs. A finite state machine might be the algorithm behind the spell check software on your computer or the artificial intelligence that controls the bosses in the game you have been playing.
Once you have completed this task, the sky's the limit — what else can you track with your robotic state machine?