Skip to content

Instantly share code, notes, and snippets.

@tcoopman
Last active July 1, 2020 18:50
Show Gist options
  • Save tcoopman/ce0d10acd51cc82aa852c696b36ae814 to your computer and use it in GitHub Desktop.
Save tcoopman/ce0d10acd51cc82aa852c696b36ae814 to your computer and use it in GitHub Desktop.
Vending Machine
Vending Machine
OrderProcessStarted
WaitingForMoney*
insert coin -> validating coin
select product -> validating selection
request return coins -> returning coins
validating coin
valid -> WaitingForMoney
invalid -> Returning Coin
validating selection
product available? -> validating price
product not available? -> WaitingForMoney
validating price
exact coins? -> dispensing product
too many coins? -> returning change
not enough coins? -> WaitingForMoney
Returning Coin
return coin -> WaitingForMoney
returning change
return coin -> dispensing product
returning coins
returning all coins -> WaitingForMoney
dispensing product
dispense -> WaitingForMoney
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment