/* Cocktail part in Picat. From Adrian Groza "Modelling Puzzles in First Order Logic" See https://www.researchgate.net/publication/374588335_Measuring_reasoning_capabilities_of_ChatGPT """ Puzzle 52. Cocktail party Six people meet at a cocktail party. Their names are Annie, Brian, Celia, Don, Erica, and Frank, and their professions, though not necessarily respectively, are Teacher, Engineer, Programmer, Doctor, Accountant, and Solicitor. 1. Frank and the Teacher both vote Tory. 2. Don and the Engineer both vote Liberal. 3. Annie and the Programmer both vote Labour. 4. Celia and Erica are both Scots. The programmer is Welsh. 5. The Accountant is older than Frank. 6. The Solicitor is older than Annie. 7. Celia and the Teacher both adore classical music. 8. Annie and the Accountant both hate the classics but love jazz. What is each person’s respective profession? (puzzle 65 from Clessa (1996)) """ Solution: Annie: Doctor Brian: Programmer Celia: Engineer Don : Accountant Erica: Teacher Frank: Solicitor This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => N = 6, L = [Annie,Brian,Celia,Don,Erica,Frank], L = 1..N, Names = ["Annie","Brian","Celia","Don","Erica","Frank"], Profession = new_list(N), Profession :: 1..N, Profession = [Teacher,Engineer,Programmer,Doctor,Accountant,Solicitor], ProfessionS = ["Teacher","Engineer","Programmer","Doctor","Accountant","Solicitor"], all_different(Profession), % 1. Frank and the Teacher both vote Tory. Frank #!= Teacher, Frank #!= Engineer, Frank #!= Programmer, % 2. Don and the Engineer both vote Liberal. Don #!= Engineer, Don #!= Teacher, Don #!= Programmer, % 3. Annie and the Programmer both vote Labour. Annie #!= Programmer, Annie #!= Engineer, Annie #!= Teacher, % 4. Celia and Erica are both Scots. The programmer is Welsh. Celia #!= Programmer, Erica #!= Programmer, % 5. The Accountant is older than Frank. Accountant #!= Frank, % 6. The Solicitor is older than Annie. Solicitor #!= Annie, % 7. Celia and the Teacher both adore classical music. Celia #!= Teacher, Celia #!= Accountant, % 8. Annie and the Accountant both hate the classics but love jazz. Annie #!= Accountant, Annie #!= Teacher, solve(Profession), println(Profession), foreach(I in 1..N) element(Prof,Profession,I), printf("%-5s: %-10s\n",Names[I],ProfessionS[Prof]) end, fail, nl.