-
-
Save jasondown/25daecfb1a24c5120552dbf382ee83c4 to your computer and use it in GitHub Desktop.
This file contains 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
// test | |
let p = Printer(System.Console.Out.WriteLine) | |
let vm = VendingMachine(3, p) | |
let cust = HungryCustomer(vm, 1, p) | |
cust.Order() | |
cust.Order() | |
cust.Order() | |
// fsi: | |
// Customer 1 is still hungry and orders another | |
// Vend item to customer 1 | |
// New stock: 2 | |
// Customer 1 is still hungry and orders another | |
// Vend item to customer 1 | |
// New stock: 1 | |
// Customer 1 is still hungry and orders another | |
// Vend item to customer 1 | |
// New stock: 0 | |
cust.Order() | |
cust.Order() | |
// fsi: | |
// Request for customer 1 will be fulfilled after machine is restocked | |
// Request for customer 1 will be fulfilled after machine is restocked | |
cust.Done() | |
// fsi: | |
// Customer 1 is getting full, so stops ordering | |
vm.Restock(5) | |
// fsi: | |
// Restocking with 5 | |
// Current stock: 5 | |
// Vend item to customer 1 | |
// New stock: 4 | |
// Vend item to customer 1 | |
// New stock: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment