Skip to content

Instantly share code, notes, and snippets.

@stackdump
Last active March 10, 2017 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stackdump/9d8c3a4141d3ddca33f5a1dab6885dd8 to your computer and use it in GitHub Desktop.
Save stackdump/9d8c3a4141d3ddca33f5a1dab6885dd8 to your computer and use it in GitHub Desktop.
A leap year counter state machine

Leap Year Counter

State Machine

StateMachine

So the events if you triggered them around the circle look like this (latest on top)

{
    "events": [
        { "action": "T4", "state": [ 1, 2, 0, 0, 0 ] },
        { "action": "T3", "state": [ 0, 1, 0, 1, 0 ] },
        { "action": "T2", "state": [ 0, 1, 1, 0, 0 ] },
        { "action": "T1", "state": [ 0, 1, 0, 0, 1 ] },
        { "action": "T4", "state": [ 1, 1, 0, 0, 0 ] },
        { "action": "T3", "state": [ 0, 0, 0, 1, 0 ] },
        { "action": "T2", "state": [ 0, 0, 1, 0, 0 ] },
        { "action": "T1", "state": [ 0, 0, 0, 0, 1 ] }
    ],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment