Home | Notes | Languages | Programs | Homework |
Re: Program 3 |
Stephen Edwards (edwards@CS.VT.EDU)
Wed, 21 Mar 2001 09:05:29 -0500
Message-ID: <3AB8B529.9753B99@cs.vt.edu> Date: Wed, 21 Mar 2001 09:05:29 -0500 From: Stephen Edwards <edwards@CS.VT.EDU> Subject: Re: Program 3
Robert Kaminsky wrote:
>
> I have a couple of questions about program 3:
> - From the clues given you know that Drinker3 will be Petit, Server4 will
> be Marcella, and Drink5 will be Cocktail. Is it acceptable to set facts
> such as: drinker3(petit), server4(marcella), and drinks5(cocktail) and use
> a rule to set the respective variables?
No, this isn't appropriate. Note that by careful application of brain
power, one can "deduce" the values of all variables from the clues,
but simply solving the puzzle first by hand, and then writing a "canned"
solution as facts isn't in the spirit of the assignment. Of course,
you'll probably want to solve the thing by hand to be able to double-
check the work of your program, but that's a different story :-).
> - The prolog compiler didn't like facts starting with capital letters or
> containing spaces.
No. Remember that in Prolog, an initial capital letter signifies a
variable instead of an atom, and that atoms follow lexical rules similar
to variable names in C++ (only letters, digits, or underscores, and must
start with a non-digit).
Please use all lower case for names and use underscores in place
of spaces when translating words in the problem statement into
Prolog atoms.
-- Steve
-- Stephen Edwards 604 McBryde Hall Dept. of Computer Science e-mail : edwards@cs.vt.edu U.S. mail: Virginia Tech (VPI&SU) office phone: (540)-231-5723 Blacksburg, VA 24061-0106 -------------------------------------------------------------------------------
Home | Notes | Languages | Programs | Homework |