home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / prolog / 1449 < prev    next >
Encoding:
Text File  |  1992-07-25  |  2.3 KB  |  78 lines

  1. Newsgroups: comp.lang.prolog
  2. Path: sparky!uunet!munnari.oz.au!manuel!csc.canberra.edu.au!oak!tp847807
  3. From: tp847807@oak.canberra.edu.au (Robert A. Nader)
  4. Subject: A simple logic problem.
  5. Message-ID: <tp847807.712050871@oak>
  6. Sender: news@csc.canberra.edu.au
  7. Organization: Info Sci & Eng, University of Canberra, AUSTRALIA
  8. Date: 25 Jul 92 07:54:31 GMT
  9. Lines: 67
  10.  
  11.  
  12. Hi, I am currently teaching myself PROLOG as I will be doing next
  13. semester a unit (Software Engineering 1) where PROLOG and Proof of
  14. Correctness are taught.  
  15.  
  16. During this semester break I have borrowed several books on the subject
  17. and started to write some basic PROLOG programs and run them with 
  18. the ARITY 4.51 interpreter......
  19.  
  20. The following *IS NOT* an assignment or tutorial excercise issued by
  21. the lecturer, it is a simple logic problem found in "Logic Problems" 
  22. issue No. 31, by A.J. Duncum, Librex Press: "A collection of puzzles
  23. designed to challenge and develop your powers of logical thinking in a 
  24. fascinating and entertaining way ....".
  25.  
  26. With my very basic PROLOG skills I attempted and solved the following
  27. problem, in a rather unelegant way. Now, as programming style is
  28. still important my question is:  
  29.  
  30. Can anyone please solve this simple logic problem and e-mail to me the
  31. solution, including if possible some comments.
  32.  
  33. /*
  34. MUSIC MEN
  35.  
  36. Three friends like different kinds of music.  From the clues given
  37. below, can you identify them, say how old each is, and work out
  38. his musical preference?
  39.  
  40. Clues: 
  41. 1.    Rob is older than Queen, who likes classical music.
  42. 2.    The pop-music fan, who is not Prince, is not 24.
  43. 3.    Leon, who is not King, is 25.
  44. 4.    Mark's musical preference is not jazz.
  45.  
  46. Knowledge: "this is what we know of the world."
  47. Names        : Leon, Mark, Rob.
  48. Surnames    : King, Prince, Queen.
  49. Ages        : 24, 25, 26.
  50. Music        : Classical, Jazz, Pop.
  51.  
  52. */
  53.  
  54.  
  55. /* solution */
  56. /*
  57. Leon Prince, 25, jazz.
  58. Mark Queen, 24, classical.
  59. Rob King, 26, pop.
  60. */
  61.  
  62.  
  63. /* end of file */
  64.  
  65. ________________________________________________________________
  66.  
  67. See ya,
  68. Robert.
  69.  
  70. UG Bachelor of Arts in Computing Studies
  71. University of Canberra, Australia.
  72.  
  73. Internet: tp847807@fir.canberra.edu.au  - Canberra University.
  74.       robnader@coombs.anu.edu.au    - Australian National University.
  75.           
  76. Phone: Home - voice: 61-6-241-6488 .
  77. ____________________________________________________________________________
  78.