Skip to content

Instantly share code, notes, and snippets.

@robertpenner
Last active August 6, 2021 21:13
Show Gist options
  • Save robertpenner/42cc2c41d90b15f1fa8013c719f2a508 to your computer and use it in GitHub Desktop.
Save robertpenner/42cc2c41d90b15f1fa8013c719f2a508 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const machine = Machine({
id: "A Pro-Am Round - Team of 2",
type: "parallel",
states: {
"Player 1 - Amateur": {
id: "P1",
type: "parallel",
states: {
hole: {
initial: "none",
states: {
none: {
on: {
"START ROUND": "hole 1",
},
},
"hole 1": {
on: {
"BALL HOLED BY P2": "hole 2",
},
},
"hole 2": {
on: {
"BALL HOLED BY P2": "hole 18",
},
},
"hole 18": {
on: {
"BALL HOLED BY P1": "done",
},
},
done: {},
},
},
status: {
initial: "waiting",
states: {
waiting: {
on: {
"START ROUND": "playing",
"BALL HOLED BY P2": "playing",
},
},
playing: {
on: {
"BALL HOLED BY P1": "waiting",
},
},
},
},
},
on: {},
},
"Player 2 - Pro": {
id: "P2",
type: "parallel",
states: {
hole: {
initial: "none",
states: {
none: {
on: {
"BALL HOLED BY P1": "hole 1",
},
},
"hole 1": {
on: {
"BALL HOLED BY P1": "hole 2",
},
},
"hole 2": {},
"hole 18": {},
},
},
status: {
initial: "waiting",
states: {
waiting: {
on: {
"BALL HOLED BY P1": "playing",
},
},
playing: {
on: {
"BALL HOLED BY P2": "waiting",
},
},
},
},
},
},
},
on: {
'START ROUND': {},
'BALL HOLED BY P1': {},
'BALL HOLED BY P2': {},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment