I finished typing Animal in today. When I was typing it in the only changes I made were to the text that was displayed. I changed it from all upper case to upper and lower case. The second half of the code was the most complicated with multiple parenthesis, quotes, double quotes and slashes.
Then it was time to start debugging. My first priority it to debug the program to the book. By that, I want to make it run like the copy in the book does, with little or no modifications.
The first thing I noticed was there were no question marks after questions. Some versions of BASIC display a question mark for every input statement. Others, like AppleSoft only display the question mark if there is no prompt included in the statement.
I fixed the first question (prompt) at line 130 to include a question mark.
This first question (Are you thinking of an animal ?) has three answers: yes, no and list. Yes starts the guessing part of the game and list gives a list of the animals the program knows. If the answer is not LIST or Yes you are asked (Are you thinking of an animal?) all over again.
I tried to list. The program starts of only knowing two animals Fish and Bird. Of course the first time through it just listed the first letter of each animal. I looked at the section of code that handles this list (600-680) and found that line 640 handles printing the actual items in the list. The last part of the line looks like NEXT I, but by changing it to NEXT Z makes it print the whole animal name. This time around it prints FishBird. Double checking the code show nothing obvious, so we’ll come back to it later.
When playing the game the next question that comes up without a question mark is (The animal you were thinking of was a) is at line 240, so I went in and changed the prompt to include the question mark.
That was all I had time for today.
Recent Comments