Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created August 1, 2018 10:07
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 jezinka/0dd35384253a523e0269eee4ec30a883 to your computer and use it in GitHub Desktop.
Save jezinka/0dd35384253a523e0269eee4ec30a883 to your computer and use it in GitHub Desktop.
static Map<State, List> state_machine_definition = [
(State.ALIVE): [
[event: Event.OVER_POPULATION, to: State.DEAD],
[event: Event.UNDER_POPULATION, to: State.DEAD],
[event: Event.STABLE, to: State.ALIVE, afterAction: 'increment'],
],
(State.DEAD) : [
[event: Event.REPRODUCTION, to: State.ALIVE, afterAction: 'reset'],
[event: Event.STABLE, to: State.DEAD]
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment