Bananas

A hand-drawn vector illustration of a mix of fruits, including a banana, an orange, a bunch of grapes, and a cherry, with dot shading.
Operating System:
Commodore 64
Category:
Game
Genre:
Educational, Logic, Puzzle
Sources:
Science in Action - Computer Games
Date Added:
19 April 2026
DownloadBack to Results

In this game the computer tries to guess your favourite food. It asks questions to which you can reply by entering capital Y for yes or capital N for no.

At first the computer does not do very well. However, if you play several games the computer will build up a question ‘tree’ by asking players to enter extra questions that have yes or no answers.

If the computer cannot answer your question the message “SUGGEST ANOTHER QUESTION” will appear. For instance, the question “WHAT COLOUR IS IT?” would be rejected because the answer is neither Y nor N. In the same way, if your favourite food is LEMONS, and the computer guesses BANANAS, the question “IS IT YELLOW?” would be no good because it has the answer Y for both fruits.

The program allows the computer to store up to 49 questions and 50 types of food. If your machine has room for more questions in its memory, you may increase the value of J in line 110.

Whenever you play this game remember that typing RUN clears the computer’s memory. To restart the game without losing the current stock of questions, type GOTO 200.

PROGRAM NOTES

Lines 100-160: Reserve memory space for lists of questions and answers, store initial data and set display colours.

Lines 200-220: Give you time to decide on your favourite food.

Line 230: Sends the computer to the ‘guess’ routine if there are no more questions to ask.

Lines 240-270: Print a series of questions using the numbers stored in arrays Y and N. For example, if the answer to question Q$(5) is Y then the number of the next question in the ‘tree’ is Y(5).

Lines 300-370: Print the computer’s guess and jump to the end of the program if the guess is correct or if the reserved memory space is full.

Lines 380-550: Input an extra question and answers to it, then store appropriate numbers in arrays Y and N.

Lines 600-620: Send the computer back to the start of the question sequence or stop the program.

Lines 800-820: Store questions and answers.

Download
5 1 vote
Article Rating
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
2
0
Would love your thoughts, please comment.x
()
x