Skip to content

Files

Latest commit

27c2b58 · Jun 23, 2020

History

History

03

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 23, 2020
Jun 23, 2020
Jun 23, 2020
Jun 23, 2020
Jun 23, 2020

Exercise 03 - Interpreter

Goals

Interpret state machines by using an interpreter. The machine should toggle between the inactive and active states:

  • In the inactive state, when a mousedown event happens, go to active.
  • In the active state, when a mouseup event happens, go to inactive.

Tips

  • Use the same machine as Exercise 02.
  • Use interpret(...) to create a service that interprets the machine.
  • Start the service with service.start().
  • Use service.send(...) to send events to the running service.

Extra Credit

  • Send the raw event from the event handler to the service instead. Notice how it fits the event object shape!
  • Practice stopping the service when you no longer need it with service.stop() (e.g., after 10 seconds or so).