Article View: comp.lang.prolog
Article #111A simple logic problem.
From: Robert A. Nader
Date: Sat, 25 Jul 1992 07:54
Date: Sat, 25 Jul 1992 07:54
67 lines
2430 bytes
2430 bytes
Hi, I am currently teaching myself PROLOG as I will be doing next
semester a unit (Software Engineering 1) where PROLOG and Proof of
Correctness are taught.
During this semester break I have borrowed several books on the subject
and started to write some basic PROLOG programs and run them with
the ARITY 4.51 interpreter......
The following *IS NOT* an assignment or tutorial excercise issued by
the lecturer, it is a simple logic problem found in "Logic Problems"
issue No. 31, by A.J. Duncum, Librex Press: "A collection of puzzles
designed to challenge and develop your powers of logical thinking in a
fascinating and entertaining way ....".
With my very basic PROLOG skills I attempted and solved the following
problem, in a rather unelegant way. Now, as programming style is
still important my question is:
Can anyone please solve this simple logic problem and e-mail to me the
solution, including if possible some comments.
/*
MUSIC MEN
Three friends like different kinds of music. From the clues given
below, can you identify them, say how old each is, and work out
his musical preference?
Clues:
1. Rob is older than Queen, who likes classical music.
2. The pop-music fan, who is not Prince, is not 24.
3. Leon, who is not King, is 25.
4. Mark's musical preference is not jazz.
Knowledge: "this is what we know of the world."
Names : Leon, Mark, Rob.
Surnames : King, Prince, Queen.
Ages : 24, 25, 26.
Music : Classical, Jazz, Pop.
*/
/* solution */
/*
Leon Prince, 25, jazz.
Mark Queen, 24, classical.
Rob King, 26, pop.
*/
/* end of file */
________________________________________________________________
See ya,
Robert.
UG Bachelor of Arts in Computing Studies
University of Canberra, Australia.
Internet: tp847807@fir.canberra.edu.au - Canberra University.
robnader@coombs.anu.edu.au - Australian National University.
Phone: Home - voice: 61-6-241-6488 .
____________________________________________________________________________
Technical Details
Message-ID:
<tp847807.712050871@oak>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!manuel!csc.canberra.edu.au!oak!tp847807Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!manuel!csc.canberra.edu.au!oak!tp847807 From: tp847807@oak.canberra.edu.au (Robert A. Nader) Subject: A simple logic problem. Message-ID: <tp847807.712050871@oak> Sender: news@csc.canberra.edu.au Organization: Info Sci & Eng, University of Canberra, AUSTRALIA Date: 25 Jul 92 07:54:31 GMT Lines: 67