zebra-puzzle

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

How to get individual results while solving Einstein's riddle with OWL in Protégé?

冷暖自知 提交于 2019-12-18 18:42:32
问题 I would like to better understand ontologies and reasoning. There is an interesting puzzle called Einstein's riddle on the net that can be solved with the help of ontologies and reasoning. I downloaded the OWL ontology from that site and imported it into Protege 4.0.2 (does not work with 4.1). I can start a reasoner by Reasoner → FaCT++ , Reasoner → Classify… , but i don't know, how to visualize the individual results. How can I do this? 回答1: There are two ways in which you can visualise the

How to get individual results while solving Einstein's riddle with OWL in Protégé?

五迷三道 提交于 2019-12-18 18:42:01
问题 I would like to better understand ontologies and reasoning. There is an interesting puzzle called Einstein's riddle on the net that can be solved with the help of ontologies and reasoning. I downloaded the OWL ontology from that site and imported it into Protege 4.0.2 (does not work with 4.1). I can start a reasoner by Reasoner → FaCT++ , Reasoner → Classify… , but i don't know, how to visualize the individual results. How can I do this? 回答1: There are two ways in which you can visualise the

Einstein Riddle with List of terms

旧街凉风 提交于 2019-12-17 21:11:20
问题 I implemented Einstein Riddle in Prolog and I'm trying to find out who had a fish at home. I can't find fault in this code and trace option is not helping with this problem ;) Rules: Norwegian lives in first house The Englishman lives in a red house. The green house is located directly on the left side of the white house. Dane drink tea. Light smoker lives next to the breeders of cats. A resident of the yellow house smokes a cigar. German smokes a water-pipe. A resident of the center house

Prolog Logic/Einstein Puzzle

谁说我不能喝 提交于 2019-12-13 21:15:32
问题 The problem is Brown, Clark, Jones and Smith are four substantial citizens who serve the community as architect, 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 older than he is and has a larger income than the men who are younger than Clark The banker who earns more than the architect, is neither the youngest or the oldest. The doctor, who is a poorer golfer than the