Algorithm X in CoffeeScript