Sei sulla pagina 1di 2

DSA555 Data Structures & Algorithms

Assignment #2 Summer 2015


Animal Guessing Game
In this assignment you will use the C++ programming
develop an animal guessing game that uses binary trees.

language

to

You pretend that you are an animal, and the program asks questions to
try to guess which animal you are. If the program guesses correctly,
another round of the game is started. And if the program cant figure
out what you are, you provide some more knowledge to the program so
that the next time the game is played; the program is a bit smarter.
As an example you are pretending to be a raccoon. The program might
start by asking
Q:Are you a mammal?
A:Yes
Q:Are you bigger than a cat?
A:Yes
Q:Are you a kangaroo?
A:No, Dont be ridiculous
I give up. What are you?
At this point you will explain that you are raccoon. You then provide
the program with a question that the program can use in future to
distinguish a kangaroo from a raccoon Are you a marsupial? and you
tell the program that the answer to this question is yes for a
kangaroo but no for a raccoon, so that the next time the program
will run, it should be able to guess you.
Type a question that will distinguish a raccoon from a kangaroo. Your
question.
Are you a marsupial?
As a raccoon, Are you a marsupial?
No.
It will then be added to the knowledge tree.
Q:Are you a mammal?
A:Yes
Q:Are you bigger than a cat?
A:Yes
Q: Are you a marsupial?
A:No
Are you a raccoon?
Yes
Good, Shall we play again
The initial knowledge tree is obtained by reading information from a
text file. Also, when the program ends, the knowledge is written to

the same file. You must carefully specify the format of data in this
file. The format should make it easy to do two things:
Read the file and set the initial tree
Write the knowledge tree to the file, using some kind of
traversal.
Check the following two files as how to develop the program.
1) Animal_tree.doc: Contains a sample tree of question answers.
2) Animal_files.doc: Contains description of the required files.
Submission Guidelines:
---------------------You are encouraged to test your program in as many C++ environments as
are available to you, but for submission purposes, your program must
work on Windows using the Visual Studio 2013 compiler.
Once you have completed and thoroughly tested your program, the source
file must be sent to your instructor by e-mail following the
guidelines written below:
1. E-mail must be sent to: asma.paracha@senecacollege.ca
2. E-mail subject must be: your subject's course code and
assignment number(DSA555_a2)
3. E-mail
must
be
sent
from
your
learn
account
(i.e.
userid@learn.senecac.on.ca)
4. The body of the e-mail is to remain empty (no text or
messages)
5. and you must attach all of the files as described in the
assignment
6. outline/requirements (ALL FILES ARE TO BE PLAIN TEXT ONLY!
NO *.zip, or *.rar, or *.tar.gz, etc will be accepted).
Late Penalty:
------------An assignment which is late will receive a penalty of 10% for every
week late (with no maximum penalty)!
NOTE: DSA555 requires that all assignments must be submitted in
perfect working order. An assignment which does not produce the
correct output must be fixed and resubmitted, at which time it will
receive a mark that is 50% of what it would have received if it had
not been resubmitted. This means that if you know that your program
doesn't quite work, you are better off to continue working on it and
submitting it a bit late, than to hand in something just to be ontime!
Due Date:
--------Monday July 13th, 2015 by 11:59:59 p.m.
This assignment is worth 10% of your
semester.
Good Luck!

final

grade

in

DSA555

this

Potrebbero piacerti anche