Class notes: 12 September, 2019

State machine transitions

Documenting a state machine: Omnigraffle (mac) vs. SmartDraw (win10) vs. ??? (linux) vs. whiteboard.  One nice thing about mobile phones is that you can now do “save as” on a whiteboard simply by taking a picture.

Finite state machine

A finite state machine (FSM) needs states, transitions, and actions which are transitions that operate outside of the state machine.  We use the word “finite” to define that there are only a certain number of states in a machine and that a machine can only be in a single state.

This is a valid FSM:

automobile_door:  open_unlocked, closed_locked, closed_unlocked

This is an invalid FSM:

automobile_door:  open, closed, locked, unlocked

Ask yourself why one is valid and how the other could be invalid.

Multiple FSMs

Say you have two state machines for two actors in a game, “Barney” and “The Monster”.  Each will have it’s own set of states, but a change in one state — The Monster goes to “is visible” — sends a signal to Barney to changed to the state  “on_patrol” so it is looking for The Monster.

Where do Barney and The Monster exist?  They could be child state machines of The Encounter Room which has states of lights_on, lights_off, emergency_alert, and fire_sprinklers_activated.   Barney and The Monster can have transitions that also notify The Encounter Room and allow it to make decisions on changing it’s own state or sending state change mechanisms to Barney and The Monster.

How can we define an “action” and not a “transition”?

Movie transitions that also add to the plot:

Alerts of state changes that let you know an otherwise undetectable FSM has changed states:

  • microwave ding when it’s finished heating
  • countdown timer to start an event (from waiting -> running)
  • RFID EZPass validation light
  • elevator alerts for current floor and direction

When can visual interaction replace sound or motion?

  • baby monitor that translates sound to video
  • GFCI lights that indicate status of interrupt
  • replace sound warning with video flash, Mac Terminal

What sounds are important in FSM and what sounds are simply decorations?

Turning keypress sounds on and off on phones and keyboards

Dialer tones (DTMF) in response to pressing buttons on a mobile that doesn’t use DTMF

a range of car horns for different listeners

faked car sounds to impress the driver and passengers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.