Skip to content

Instantly share code, notes, and snippets.

View acidtone's full-sized avatar

Tony Grimes acidtone

  • Southern Alberta Institute of Technology
  • Calgary
View GitHub Profile
//finite state machine
const machine = {
state: "SOBER",
drunklevel: 0,
transitions: {
SOBER: {
drink: function(beverage, second) {
console.log("current state", this.state, this.drunklevel);
console.log("\tdrinking", beverage.type); //second would be undefined
if (beverage.type == "alcohol") {