Last active
August 5, 2021 20:42
-
-
Save robertpenner/13e84f52841f13e7e81b6be21a72709f to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const machine = Machine({ | |
id: 'Tournament', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
on: { 'SCHEDULE TOURNAMENT': 'pre' }, | |
}, | |
pre: { | |
on: { 'START TOURNAMENT': 'during' }, | |
}, | |
during: { | |
initial: 'groupings official', | |
states: { | |
'groupings official': { | |
on: { | |
'START PLAY': 'playing', | |
}, | |
}, | |
playing: { | |
initial: 'round 1', | |
states: { | |
'round 1': { | |
initial: 'in progress', | |
states: { | |
'in progress': { | |
on: { 'COMPLETE ROUND': 'complete' } | |
}, | |
complete: { | |
on: { 'START NEXT ROUND': '#round 2' }, | |
}, | |
}, | |
}, | |
'round 2': { | |
id: 'round 2', | |
initial: 'in progress', | |
states: { | |
'in progress': { | |
on: { 'COMPLETE ROUND': 'complete' } | |
}, | |
complete: { | |
on: { 'START NEXT ROUND': '#round 3' }, | |
}, | |
}, | |
}, | |
'round 3': { | |
id: 'round 3', | |
initial: 'in progress', | |
states: { | |
'in progress': { | |
on: { 'COMPLETE ROUND': 'complete' } | |
}, | |
complete: { | |
on: { 'START NEXT ROUND': '#round 4' }, | |
}, | |
}, | |
}, | |
'round 4': { | |
id: 'round 4', | |
initial: 'in progress', | |
states: { | |
'in progress': { | |
on: { 'COMPLETE ROUND': '#tallying' } | |
}, | |
}, | |
}, | |
tallying: { | |
id: 'tallying', | |
on: { | |
'TRIGGER PLAYOFF': 'playoff', | |
WINNER: 'done', | |
}, | |
}, | |
playoff: { | |
on: { | |
'PLAYOFF COMPLETE': 'done', | |
}, | |
}, | |
done: { type: 'final' }, | |
history: { | |
type: 'history', | |
history: 'deep', | |
}, | |
}, | |
on: { | |
'DELAY PLAY': 'play delayed', | |
}, | |
}, | |
'play delayed': { | |
on: { | |
'RESUME PLAY': 'playing.history' | |
}, | |
}, | |
}, | |
on: { 'COMPLETE TOURNAMENT': 'complete' }, | |
}, | |
complete: { | |
on: { 'TOURNAMENT INACTIVE': 'inactive' }, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment