Here is a version that saves a data file so that the program doesn't forget what it learnedDATA "4","\QDOES IT SWIM\Y2\N3\","\AFISH","\ABIRD"
PRINT TAB(15);
"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" PRINT "PLAY 'GUESS THE ANIMAL'" PRINT "THINK OF AN ANIMAL AND THE COMPUTER WILL TRY TO GUESS IT." NOFILE:
MAIN
' MAIN CONTROL SECTION
INPUT "ARE YOU THINKING OF AN ANIMAL (Y/N)"; A$: A$
= UCASE$(A$
) IF A$
= "LIST" THEN SHOWLIST: MAIN
K = 1
SHOWQUESTION
INPUT "THE ANIMAL YOU WERE THINKING OF WAS A "; V$
PRINT "PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A" PRINT "FOR A "; V$;
" THE ANSWER WOULD BE ";
A$(Z1) = A$(K)
A$(Z1 + 1) = "\A" + V$
A$
(K
) = "\Q" + X$
+ "\" + A$
+ STR$(Z1
+ 1) + "\" + B$
+ STR$(Z1
) + "\"
' SUBROUTINE TO PRINT QUESTIONS
Q$ = A$(K)
T$ = "\" + C$
K
= VAL(MID$(Q$
, X
+ 2, Y
- X
- 2))
X = 0
' SUBROUTINE TO SAVE DATA FILE
Nice! you fixed the parsing problem for asking the questions and converted everything to SUBs AND saved the new learning to file! I recommend UCASE$ conversions for all INPUTs so can type INPUTs in lower case and will be automatically converted to upper and remain consistent to the other parts of program.
See? the dog lesson didn't take though it did ask the right question, it thinks it hasn't guessed it yet.
Ha! I've still not analysed the structure to the A$() array, I wanted to see how that N got used at the start, looks like MidnightOwl... no he SHARED it along with some others with his SUBs.
Oh there's the data, right at the top, allready to go if a file hadn't been started yet!
Now what does file look like after I started dog?
Animal.DAT the saved lesson on DOG, I see N is increased to 6
" 6"
"\QDOES IT SWIM\Y2\N3\"
"\AFISH"
"\QDOES IT FLY\N 5\Y 4\"
"\ABIRD"
"\ADOG"
So N is left at A$(0) and tracks the last line number in the file or A$() array. I still need to go over structure for storing data in array. MidnightOwl had to solve all that.
So how do we get practice for Kiara using arrays and then SUBs and FUNCTIONs? This might have been too hard but maybe a demo of what you can do with some practice behind you.
All newbies need this practice, they are the bigger hurdles for novice.