News for hackers. Stuff that matters.
Re:Solving murder with Prolog by waterhouse on Monday December 24, 2018 @09:40PM (#18755532)
The author's interpretation of clue 2 seemed odd:

  % % 3. Clue 2: Barbara was either in the study or the bathroom; Yolanda was in the other.
  % % Which room was Barbara found in?
    woman(Bathroom), woman(Study), \+christine=Bathroom, \+christine=Study, 
    \+barbara=Dining, \+barbara=Kitchen, \+barbara=Livingroom, \+barbara=Pantry,
I thought, surely there's a better way to write that, a way that closely resembles the English "either a and b, or c and d". And Prolog in fact has disjunctions. (Prolog noob here, first time I've ever run a Prolog program.) Thus:

    (barbara=Study, yolanda=Bathroom ; barbara=Bathroom, yolanda=Study),
I verified that the program still works with that change, and the performance seems equivalent. (Takes about 7 seconds to run on my 1.3Ghz fanless laptop.)

There are no comments on this comment yet.