I am trying to solve this puzzle using prolog and I am having difficulty writing down the rules and finishing the solution. This is the puzzle...
Last weekend was the men’s annual bowling tournament, an event of competition and fun for the local townspeople. This year, excitement ran high as five contestants bowled neck and neck for the championship. Each time a bowler won a game, he scored two points and the bowler with the highest number of points at the end of the tournament won. Determine the full name of each bowler, their high score (264 to 288), and how many points each won (28 to 36).
Frank, whose last name wasn’t Thompson, had the highest score but he didn’t win the tournament.
Mr. Smith’s high score was three pins higher than that of the bowler with 30 points.
Steven’s last name wasn’t Stewart. The winner of the tournament, who had 36 points, had an odd number for a high score.
Michael finished the tournament with six points less than Mr. Williams.
The bowler with a high score of 273 had two points more than Mr. Smith but two points less than Craig.
Mr. Thompson won fewer points than Walter but more than Steven Lewis.
And this is what I have so far...
first[craig].
first[frank].
first[michael].
first[steven].
first[walter].
last[thompson].
last[williams].
last[smith].
last[lewis].
last[stewart].
high[264].
high[288].
high[276].
high[276].
high[273].
high[285].
points[32].
points[34].
points[28].
points[30].
points[36].'''
'''Sol=[[first(craig),last(Thompson), first(FrankWilliams)]]'''
Please help me
[Logic Diagram picture][1]
[1]: https://i.stack.imgur.com/Wi5lE.png
This is a fairly simple but slow solution:
Result in swi-prolog: