I need help with this C language program. Please help me ASAP. Assignment The objective of this
Question:
I need help with this C language program. Please help me ASAP.
Assignment
The objective of this lab is to write a 20-questions style guessing game that gets smarter as you play. To achieve this, you will create a decision tree data structure using malloc() and free().
Game Play
When you run your program, it will be the guesser in a 20-questions game. First, you think of an animal, and the program will take a guess at what animal you are thinking of. When you first start the program, the only animal it knows is "dog", so it will ask you "Is it a dog?". If you were in fact thinking of a dog, the program says "I win!" and exits.
On the off chance that your animal was not a dog, the program will then ask what animal you were thinking of. Let's say it was a duck. The program will then ask "Please give me a yeso question that would distinguish between a dog and a duck." Let's assume you give the answer "Does it have fur?". It will then ask "Would the answer to this question be yes or no for a dog?" The program will use this answer to build a small decision tree. Next time you run the program, it will ask "Does it have fur?" If you say yes, it will guess dog, if you say no it will guess duck. Each time you play, the program adds to the decision tree and gets better at the game.
Grading:
Task | Points |
Game play: Your program should correctly compile. When run, it should play the 20-questions game an arbitrary number of times, learning a new question at each iteration. |
25 |
Program style and documentation: Your program should exhibit excellent programming style, including proper use of #define, inline comments, block comments, and ample use of whitespace for readability. Searching and inserting into your decision tree should be implemented as subroutines. |
15 |
Clean up and exit: When your program exits, it should deallocate the final decision tree, printing out each node as it is deleted. Note: this is most easily done recursively using a pre-order traversal. This will be explained in detail in the lab session. |
10 |
Example of this game is in the attached Image: