Prolog代写: Prolog Assignment

Prolog Assignment

 

Create a program that solves the logic puzzle below. Your program MUST actually SOLVE the puzzle, not just print the results. The program must find one and only one solution to the logic puzzle and that one solution must meet all of the constraints listed below.

 

 

  • Fuel Stop charges somewhat less per gallon than Vexon.
  • The business in Irvine charges somewhat more per gallon than the business in Santa Rosa.
  • Gas-N-Go doesn’t charge $1.23 per gallon.
  • The gas station in Lewis charges 8 cents less per gallon than the store in Zamora.
  • Fuel Stop charges 8 cents less per gallon than the store in Santa Rosa.
  • The business in Lewis is either Vexon or Energo.
  • Fuel Stop charges 4 cents less per gallon than Ballantines.

 

Hints:

  1. Prolog doesn’t deal well with floating point. What other form could you use?
  2. Remember that variables are capitalized and atoms are all lower case.
  3. Look at the slides (especially the logic puzzle) carefully – you can reuse code from the slides.

Get it here: http://www.swi-prolog.org/