zebra-puzzle

Puzzle in Prolog

不羁岁月 提交于 2019-12-13 08:20:00
问题 Anybody solve this Puzzle : Figure out the first name, wine, entree, and price for each person using the clues given. Below are all categories and options used in this puzzle. First names: Lynda, Nick, Robin, Virginia Wines: bordeaux, chianti, merlot, shiraz Entrees: beef stir-fry, citrus chicken, filet mignon, red snapper Prices: $24.99, $25.99, $26.99, $27.99 Clues: The diner who ordered the red snapper didn't have the bordeaux. Lynda paid less than the one who had the bordeaux. Neither the

Interpreters riddle in prolog

风格不统一 提交于 2019-12-12 01:57:30
问题 Here's a riddle's info Six interpreters: Fran French, Geraldine German, Dudley Dutch, Spike Spanish, Polly Polish and Romanian Ron. Everyone speaks two languages, among them indicating their surnames, namely French (French), Deutsch (German), Dutch (Dutch), Spanish (Spanish), Polish (Polish) and Romanian ( Romanian). The following applies: No interpreter speak the language corresponding to his surname. No two interpreters speak the same two languages ​ Each of the six languages is ​​spoken by

Clingo: assert partial constraints

一曲冷凌霜 提交于 2019-12-12 01:23:52
问题 I am trying to implement a program in clingo that solves one of those classic riddles where you have a series of assertions of facts and constraints and you have to deduce other facts. Here goes the problem: Five men of different nationalities live in five side-by-side houses, each of a different color; they all have different jobs, a different favourite animal and favourite beverages. We know that: The English man lives in the red house. The Spanish man's favourite animal is the dog. The

A “Building” Riddle in Prolog

耗尽温柔 提交于 2019-12-11 09:40:10
问题 I'm trying to solve a riddle in Prolog. the riddle is: There are two buildings, each one has tree apartments (apartment per floor): one apartment of 3 rooms,one of 4 rooms and one of 5 rooms. Dana,Joni and Noah lives in building 1. Ron,Gale and Aron lives in building 2. Joni apartment is higher then Dana and Noah. It means he lives on the third floor of building 1. Noah and Gale lives on the same floor (in different buildings). Ron has a one more room than Aron. Ron lives one floor above Gale

Einstein puzzle in Prolog

大城市里の小女人 提交于 2019-12-11 05:02:10
问题 I'm trying to solve the Einstein riddle using Prolog. Task is The Norwegian lives in the first house . The English lives in the Red House . The Swedish HAS Dogs As pets . The Danish drinks tea . The Green House is on the left of the White House. The man who lives in the green house drinks coffee . The man who smokes Pall Mall rears birds . The man living in the Yellow House smokes Dunhill . The man who lives in the Middle house drinks milk . The man who smokes Blends lives next to the one who

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

你说的曾经没有我的故事 提交于 2019-12-05 21:20:38
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 on Monday was born earlier in the year than Brenda and Mary. Tara wasn't born in February and her

Solving Einstein Riddle in Prolog

北城余情 提交于 2019-12-05 17:57:53
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(_,_,_,A,_)). exists(A, list(_,_,_,_,A)). middle_house(A, list(_,_,A,_,_)). first_house(A, list(A,_,_,_,_)).

Solving the Zebra puzzle (aka. Einstein puzzle) using the clpfd Prolog library

孤街醉人 提交于 2019-12-04 21:45:20
问题 I have been given an exercise to solve the zebra puzzle using a constraint solver of my choice, and I tried it using the Prolog clpfd library. I am aware that there are other more idiomatic ways to solve this problem in Prolog, but this question is specifically about the clpfd package! So the specific variation of the puzzle (given that there are many of them) I'm trying to solve is this one: There are five houses The Englishman lives in the red house The Swedish own a dog The Danish likes to

Solving the Zebra puzzle (aka. Einstein puzzle) using the clpfd Prolog library

爱⌒轻易说出口 提交于 2019-12-03 15:20:52
I have been given an exercise to solve the zebra puzzle using a constraint solver of my choice, and I tried it using the Prolog clpfd library . I am aware that there are other more idiomatic ways to solve this problem in Prolog, but this question is specifically about the clpfd package! So the specific variation of the puzzle (given that there are many of them) I'm trying to solve is this one: There are five houses The Englishman lives in the red house The Swedish own a dog The Danish likes to drink tea The green house is left to the white house The owner of the green house drinks coffee The

Instantiation issue when solving this Prolog Caliban problem

时光总嘲笑我的痴心妄想 提交于 2019-12-02 07:54:11
问题 I am trying to solve the following Caliban problem using Prolog: 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 youngest nor the