package net.doorstuck.vehicles protocol Vehicle - startup - shutdown - nr-wheels - nr-doors - turn(direction:dir) - accelerate(direction:dir) - velocity end class Car - startup self.engine-running = true end - shutdown self.engine-running = false end - nr-wheels ^4 end - nr-doors ^4 end - turn(direction:dir) self.current-direction = dir end - accelerate(direction:dir) match dir $forward => self.current-velocity += 1, $backward => self.current-velocity -= 1, end end - velocity ^self.current-velocity end end