Skip to content

Instantly share code, notes, and snippets.

@Swizec
Last active Aug 10, 2020
Embed
What would you like to do?
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const smolMessMachine = Machine({
id: 'smolMess',
initial: '0-0-0',
states: {
'0-0-0': {
on: {
A: '1-0-0',
B: '0-1-0',
C: '0-0-1'
},
meta: { green: 1, red: 0, blue: 0 }
},
'0-0-1': {
on: {
A: '1-0-1',
B: '0-1-1',
C: '0-0-0'
},
meta: { green: 1, red: 0, blue: 0 }
},
'0-1-0': {
on: {
A: '1-1-0',
B: '0-0-0',
C: '0-1-1'
},
meta: { green: 0, red: 0, blue: 0 }
},
'0-1-1': {
on: {
A: '1-1-1',
B: '1-0-1',
C: '0-1-0'
},
meta: { green: 1, red: 1, blue: 1 }
},
'1-0-0': {
on: {
A: '0-0-0',
B: '1-1-0',
C: '1-0-1'
},
meta: { green: 0, red: 0, blue: 1 }
},
'1-0-1': {
on: {
A: '0-0-1',
B: '1-1-1',
C: '1-0-0'
},
meta: { green: 1, red: 1, blue: 1 }
},
'1-1-0': {
on: {
A: '0-1-0',
B: '1-0-0',
C: '1-1-1'
},
meta: { green: 1, red: 0, blue: 0 }
},
'1-1-1': {
on: {
A: '0-1-1',
B: '1-0-1',
C: '1-1-0'
},
meta: { green: 1, red: 0, blue: 0 }
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment