% % logicpuzzle.pl -- the logic-puzzle problem % % Submission site id(s): % % Comments: % some "nice" prolog settings... see assignment 8's % description for the details on what these do % -- but it's not crucial to know the details of these Prolog internals :- set_prolog_flag( prompt_alternatives_on, groundness ). :- set_prolog_flag(toplevel_print_options, [quoted(true), portray(true), attributes(portray), max_depth(999), priority(699)]). % For this problem, you will need to choose a representation % and the create the constraints on that representation to % allow Prolog to solve the train-traveling logic problem % It's not required that you use the spatial-layout representation % that the solution to Einstein's puzzle used, but it's OK to do so. % You may want to start by looking over that einstein.pl code. % It should be linked at the top-level assignments page /* * * Here is the problem description: algird, bruno, collette, dino, and edwina are each from different Claremont Colleges. (Be sure to use lowercase for these constants inside Prolog!) The 5 Claremont Colleges are: pomona, pitzer, hmc, cmc, and scripps. Each one brings a different snack: jots, chocolate, donuts, pez, and spam. They are all on the train together in seats 1 (leftmost) through 5 (rightmost). Your task is to get Prolog to answer: Which student is in each seat, which college does each student go to, and what did each student bring for a snack? Constraints: 1. bruno and dino sat in the end seats. 2. algird sat next to the student from HMC. 3. collette sat next to (i.e. between) friends with chocolate and donuts. 4. The HMC student brought spam as a snack and sat in the middle seat. 5. chocolate was immediately to the left of pez. 6. bruno, dino, and algird do not go to scripps. 7. The pomona student sat between the person with jots and spam. 8. dino did not sit next to the person with donuts. 9. The CMC student did not sit next to edwina. The unique solution: This is helpful to have when debugging... . Seats = [[bruno,cmc,jots], [algird,pomona,donuts], [collette,hmc,spam], [edwina,scripps,chocolate], [dino,pitzer,pez]] Hints/guidelines: Use the einstein.pl example as a starting point and as a guide to some useful helper predicates! * * */