Skip to content

Instantly share code, notes, and snippets.

@stackdump stackdump/leap_machine.md
Last active Mar 10, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.