What is a finite state machine