Skip to content

Instantly share code, notes, and snippets.

@santolucito
Created September 24, 2023 22:35
Show Gist options
  • Save santolucito/e6798ba5eef6f244ba3399c1b9dbeffa to your computer and use it in GitHub Desktop.
Save santolucito/e6798ba5eef6f244ba3399c1b9dbeffa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const musicMachine = Machine(
{
id: 'music',
initial: '0',
states: {
0 : {
on: {
t11:
{description: 'not((inCave passage)) and not((inMarket passage)) and not((inTown passage))',
actions: [
'passage = (toTown passage)',
'summary = (updateSummary passage)',
],
target: '1',
},
t21:
{description: '(inCave passage)',
actions: [
],
target: '2',
},
t22:
{description: '(inMarket passage)',
actions: [
],
target: '2',
},
t23:
{description: '(inTown passage)',
actions: [
],
target: '2',
},
}
},
1 : {
on: {
t11:
{description: 'not((inCave passage)) and (inMarket passage) and (inTown passage)',
actions: [
'passage = (toTown passage)',
'summary = (updateSummary passage)',
],
target: '3',
},
t21:
{description: 'not((inCave passage)) and not((inMarket passage)) and (inTown passage)',
actions: [
'passage = (toMarket passage)',
'summary = (updateSummary passage)',
],
target: '4',
},
t31:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t32:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t33:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t34:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t35:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t36:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t37:
{description: '(inCave passage)',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t38:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t39:
{description: '(inCave passage)',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
t310:
{description: 'not((inTown passage))',
actions: [
],
target: '8',
},
t311:
{description: 'not((inTown passage))',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t312:
{description: 'not((inTown passage))',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t313:
{description: 'not((inTown passage))',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t314:
{description: 'not((inTown passage))',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t315:
{description: 'not((inTown passage))',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t316:
{description: 'not((inTown passage))',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t317:
{description: 'not((inTown passage))',
actions: [
],
target: '8',
},
t318:
{description: 'not((inTown passage))',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
}
},
2 : {
on: {
t11:
{description: 'not((inCave passage))',
actions: [
],
target: '2',
},
t21:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
}
},
3 : {
on: {
t11:
{description: 'not((inCave passage)) and not((inMarket passage)) and (inTown passage)',
actions: [
'passage = (toMarket passage)',
'summary = (updateSummary passage)',
],
target: '5',
},
t21:
{description: 'not((inCave passage)) and (inMarket passage) and (inTown passage)',
actions: [
'passage = (toCave passage)',
'summary = (updateSummary passage)',
],
target: '6',
},
t31:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t32:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t33:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t34:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t35:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t36:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t37:
{description: '(inCave passage)',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t38:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t39:
{description: '(inCave passage)',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
t310:
{description: 'not((inTown passage))',
actions: [
],
target: '8',
},
t311:
{description: 'not((inTown passage))',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t312:
{description: 'not((inTown passage))',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t313:
{description: 'not((inTown passage))',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t314:
{description: 'not((inTown passage))',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t315:
{description: 'not((inTown passage))',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t316:
{description: 'not((inTown passage))',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t317:
{description: 'not((inTown passage))',
actions: [
],
target: '8',
},
t318:
{description: 'not((inTown passage))',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
}
},
4 : {
on: {
t11:
{description: 'not((inCave passage)) and (inMarket passage)',
actions: [
'passage = (toTown passage)',
'summary = (updateSummary passage)',
],
target: '3',
},
t21:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t22:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t23:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t24:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t25:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t26:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t27:
{description: '(inCave passage)',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t28:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t29:
{description: '(inCave passage)',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
t210:
{description: 'not((inMarket passage))',
actions: [
],
target: '8',
},
t211:
{description: 'not((inMarket passage))',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t212:
{description: 'not((inMarket passage))',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t213:
{description: 'not((inMarket passage))',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t214:
{description: 'not((inMarket passage))',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t215:
{description: 'not((inMarket passage))',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t216:
{description: 'not((inMarket passage))',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t217:
{description: 'not((inMarket passage))',
actions: [
],
target: '8',
},
t218:
{description: 'not((inMarket passage))',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
}
},
5 : {
on: {
t11:
{description: 'not((inCave passage)) and (inMarket passage)',
actions: [
'passage = (toCave passage)',
'summary = (updateSummary passage)',
],
target: '6',
},
t21:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t22:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t23:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t24:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t25:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t26:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t27:
{description: '(inCave passage)',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t28:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t29:
{description: '(inCave passage)',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
t210:
{description: 'not((inMarket passage))',
actions: [
],
target: '8',
},
t211:
{description: 'not((inMarket passage))',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t212:
{description: 'not((inMarket passage))',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t213:
{description: 'not((inMarket passage))',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t214:
{description: 'not((inMarket passage))',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t215:
{description: 'not((inMarket passage))',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t216:
{description: 'not((inMarket passage))',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t217:
{description: 'not((inMarket passage))',
actions: [
],
target: '8',
},
t218:
{description: 'not((inMarket passage))',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
}
},
6 : {
on: {
t11:
{description: '(inCave passage) and (inMarket passage)',
actions: [
'summary = (updateSummary passage)',
'passage = passage',
],
target: '7',
},
t12:
{description: '(inCave passage) and not((inTown passage))',
actions: [
'summary = (updateSummary passage)',
'passage = passage',
],
target: '7',
},
t21:
{description: 'not((inCave passage))',
actions: [
],
target: '8',
},
t22:
{description: 'not((inCave passage))',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t23:
{description: 'not((inCave passage))',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t24:
{description: 'not((inCave passage))',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t25:
{description: 'not((inCave passage))',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t26:
{description: 'not((inCave passage))',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t27:
{description: 'not((inCave passage))',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t28:
{description: 'not((inCave passage))',
actions: [
],
target: '8',
},
t29:
{description: 'not((inCave passage))',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
t31:
{description: '(inCave passage) and not((inMarket passage)) and (inTown passage)',
actions: [
'summary = (updateSummary passage)',
'passage = passage',
],
target: '8',
},
}
},
7 : {
on: {
t11:
{description: 'not((inCave passage)) and not((inTown passage))',
actions: [
'passage = (toTown passage)',
'summary = (updateSummary passage)',
],
target: '3',
},
t21:
{description: 'not((inCave passage)) and not((inMarket passage)) and (inTown passage)',
actions: [
'passage = (toMarket passage)',
'summary = (updateSummary passage)',
],
target: '5',
},
t31:
{description: 'not((inCave passage)) and (inMarket passage) and (inTown passage)',
actions: [
'passage = (toCave passage)',
'summary = (updateSummary passage)',
],
target: '6',
},
t41:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t42:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t43:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t44:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t45:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t46:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t47:
{description: '(inCave passage)',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t48:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t49:
{description: '(inCave passage)',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
}
},
8 : {
on: {
t11:
{description: 'not((inCave passage)) and not((inMarket passage))',
actions: [
'passage = (toMarket passage)',
'summary = (updateSummary passage)',
],
target: '5',
},
t21:
{description: 'not((inCave passage)) and (inMarket passage)',
actions: [
'passage = (toCave passage)',
'summary = (updateSummary passage)',
],
target: '6',
},
t31:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t32:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toMarket passage)',
],
target: '8',
},
t33:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = (toTown passage)',
],
target: '8',
},
t34:
{description: '(inCave passage)',
actions: [
'passage = (toCave passage)',
'passage = passage',
],
target: '8',
},
t35:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = (toTown passage)',
],
target: '8',
},
t36:
{description: '(inCave passage)',
actions: [
'passage = (toMarket passage)',
'passage = passage',
],
target: '8',
},
t37:
{description: '(inCave passage)',
actions: [
'passage = (toTown passage)',
'passage = passage',
],
target: '8',
},
t38:
{description: '(inCave passage)',
actions: [
],
target: '8',
},
t39:
{description: '(inCave passage)',
actions: [
'summary = (updateSummary passage)',
'summary = summary',
],
target: '8',
},
}
},
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment