Skip to content

Instantly share code, notes, and snippets.

@jasondown
Created December 23, 2021 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondown/7c6fb8b100a8f3440515bb478fd31c9d to your computer and use it in GitHub Desktop.
Save jasondown/7c6fb8b100a8f3440515bb478fd31c9d to your computer and use it in GitHub Desktop.
Customer 1 is still hungry and orders another
Vend item to customer 1
New stock: 4
Customer 3 is still hungry and orders another
Vend item to customer 3
New stock: 3
Customer 3 is still hungry and orders another
Vend item to customer 3
New stock: 2
Request current stock: 2
Customer 3 is still hungry and orders another
Vend item to customer 3
New stock: 1
Customer 1 is still hungry and orders another
Vend item to customer 1
New stock: 0
Customer 3 is still hungry and orders another
Request for customer 3 will be fulfilled after machine is restocked
Customer 2 is still hungry and orders another
Request for customer 2 will be fulfilled after machine is restocked
Customer 3 is getting full, so stops ordering
Restocking with 10
Current stock: 10
Vend item to customer 3
New stock: 9
Vend item to customer 2
New stock: 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment