Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (26 sloc) 0.88 kb
logic = require './logically'
# 1. The diner who ate the beef ate the squash.
# 2. The diner who ate the beef was Cronkel.
# 3. The diner who ate the turnips was not Gertel.
# 4. The diner who ate the pork was not Pendoz.
cronkel = "Cronkel"
gertel = "Gertel"
pendoz = "Pendoz"
diners = [cronkel, gertel, pendoz]
beef = "beef"
chicken = "chicken"
pork = "pork"
meats = [beef, chicken, pork]
asparagus = "asparagus"
squash = "squash"
turnips = "turnips"
vegetables = [asparagus, squash, turnips]
clue1 = new logic.DirectClue {meat: beef}, {vegetable: squash}
clue2 = new logic.DirectClue {meat: beef}, {diner: cronkel}
clue3 = new logic.IndirectClue {vegetable: turnips}, {diner: gertel}
clue4 = new logic.IndirectClue {meat: pork}, {diner: pendoz}
clues = [clue1, clue2, clue3, clue4]
logic.solve {diner: diners},
meat: meats
vegetable: vegetables,
clues
Jump to Line
Something went wrong with that request. Please try again.