zebra-puzzle


Solving Caliban problems with prolog

我的未来我决定 提交于 2020-01-05 18:57:26
问题 I'm working on solving a logic puzzle using prolog for school. Here's the clues: Brown, Clark, Jones and Smith are 4 substantial citizens who serve their community as achitect, banker, doctor and lawyer, though not necessarily respectively. Brown, who is more conservative than Jones but more liberal than Smith, is a better golfer than the men who are younger than he is and has a larger income than the men who are older than Clark. The banker, who earns more than the architect, is neither the

Solving Einstein Riddle in Prolog

雨燕双飞 提交于 2020-01-02 05:48:18
问题 I am trying to solve Einstein Riddle in Prolog. I am having a difficulty with the program I wrote, the basic method was to add all constraints and let Prolog figure out the only possible solutions. The problem is that Prolog finds 0 solutions. I have isolated the constraint that makes the program go from a given solution to no solutions, but I don't understand why. /*There are five houses*/ exists(A, list(A,_,_,_,_)). exists(A, list(_,A,_,_,_)). exists(A, list(_,_,A,_,_)). exists(A, list(_,_,

Einstein Riddle using Prolog

余生长醉 提交于 2019-12-31 03:17:08
问题 I'm trying to solve the Einstein riddle using Prolog. When I'm trying to run by houses(Hs), it shows No. Task is The Brit lives in the red house. The Swede keeps dogs as pets. The Dane drinks tea. The green house is on the immediate left of the white house. The green house's owner drinks coffee. The owner who smokes Pall Mall rears birds. The owner of the yellow house smokes Dunhill. The owner living in the center house drinks milk. The Norwegian lives in the first house. The owner who smokes

Prolog riddle solving

六眼飞鱼酱① 提交于 2019-12-25 04:48:10
问题 The statement : Four couples in all Attended a costume ball. 2 The lady dressed as a cat Arrived with her husband Matt. 3 Two couples were already there, One man dressed like a bear. 4 First to arrive wasn't Vince, But he got there before the Prince. 5 The witch (not Sue) is married to Chuck, Who was dressed as Donald Duck. 6 Mary came in after Lou, Both were there before Sue. 7 The Gipsy arrived before Ann, Neither is wed to Batman. 8 If Snow White arrived after Tess, Then how was each

Prolog riddle solving

▼魔方 西西 提交于 2019-12-25 04:48:05
问题 The statement : Four couples in all Attended a costume ball. 2 The lady dressed as a cat Arrived with her husband Matt. 3 Two couples were already there, One man dressed like a bear. 4 First to arrive wasn't Vince, But he got there before the Prince. 5 The witch (not Sue) is married to Chuck, Who was dressed as Donald Duck. 6 Mary came in after Lou, Both were there before Sue. 7 The Gipsy arrived before Ann, Neither is wed to Batman. 8 If Snow White arrived after Tess, Then how was each

Prolog and Logic Puzzles

瘦欲@ 提交于 2019-12-24 02:23:16
问题 I seem to be having an issue with the unification of facts in Prolog, but can't confirm it. Everything looks like it should work, and I've looked up examples of solved logic puzzles using Prolog to no real effect, given the relative rarity of Prolog. This is an extra credit assignment, so I'm unsure if it's valid, but I'm genuinely stumped on how to proceed from here % Names name(teo). name(mira). name(bruno). name(igor). %Food food(sandwich). food(pie). food(hamburger). food(pizza). %Hobby

Einstein's riddle

坚强是说给别人听的谎言 提交于 2019-12-24 01:39:26
问题 I am new to Prolog and I'm trying to model a riddle like the Einstein riddle, also known as the Zebra riddle, (but with 10 houses and 30 hints) in Prolog and I'm using this model example as a starting point: http://www.baptiste-wicht.com/2010/09/solve-einsteins-riddle-using-prolog/ But in my riddle, i have to be able to say that X is right of Y. And I don't mean directly right, but right of in the list. So Y can be in house 1, while X in house 9. How can I do this in Prolog? I was thinking

Why cant i get the answer to the zebra puzzle in prolog?

筅森魡賤 提交于 2019-12-23 22:13:43
问题 this is my code currently, I am trying to solve the zebra puzzle. exists(A,(A,_,_,_,_)). exists(A,(_,A,_,_,_)). exists(A,(_,_,A,_,_)). exists(A,(_,_,_,A,_)). exists(A,(_,_,_,_,A)). rightOf(A,B,(B,A,_,_,_)). rightOf(A,B,(_,B,A,_,_)). rightOf(A,B,(_,_,B,A,_)). rightOf(A,B,(_,_,_,B,A)). middleHouse(A,(_,_,A,_,_)). firstHouse(A,(A,_,_,_,_)). nextTo(A,B,(B,A,_,_,_)). nextTo(A,B,(_,B,A,_,_)). nextTo(A,B,(_,_,B,A,_)). nextTo(A,B,(_,_,_,B,A)). nextTo(A,B,(A,B,_,_,_)). nextTo(A,B,(_,A,B,_,_)). nextTo

Einstein's Riddle solution using F# [closed]

烂漫一生 提交于 2019-12-23 10:04:44
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I'm looking for Einstein's Riddle solution using F# and I've found only Einstein meets F#. Is F# suitable for this problem and are there any other implementations? 来源: https://stackoverflow.com/questions/10341464

Solving a textual logic puzzle in Prolog - Find birthday and month

让人想犯罪 __ 提交于 2019-12-22 11:35:37
问题 I'm reading the "7 Languages in 7 Days"-book, and have reached the Prolog chapter. As a learning exercises I'm trying to solve some textual logic puzzles. The puzzle goes as follow: Five sisters all have their birthday in a different month and each on a different day of the week. Using the clues below, determine the month and day of the week each sister's birthday falls. Paula was born in March but not on Saturday. Abigail's birthday was not on Friday or Wednesday. The girl whose birthday is

工具导航Map