Javascript implementation of Oskar Van Deventer's Haunted Vending Machine Puzzle