

Code: Select all
100 REMark Guess The Animal: think of an animal,computer guesses it
110 CLS : CLS #0 : DIM question$(50,56),p(50,2) : free = 2
120 question$(1)='a monster' : num=1 : REMark start from somewhere,I suppose
130 PRINT'Think of an animal, computer will try to guess it and learn from replies.'\\
140 REPeat ask
150 IF p(num,1) = 0 THEN
160 PRINT'Is it ';question$(num);'?'
170 IF INKEY$(-1)=='y' THEN
180 PRINT'I knew that!'\\'Think of an animal' : REMark a correct guess
190 ELSE
200 question$(free) = question$(num) : INPUT'What was it?';question$(free+1)
210 INPUT'Enter a question to distinguish between them:';question$(num)
220 PRINT'What is the answer for ';question$(free+1);'?'
230 IF INKEY$(-1) == 'y' THEN p(num,1) = free + 1 : p(num,2) = free:ELSE p(num,1) = free : p(num,2) = free+1
240 free = free + 2 : PRINT'A new one!'\\'Think of an animal'
250 END IF : num = 1
260 ELSE
270 PRINT question$(num);'?' : IF INKEY$(-1) == 'y' THEN num = p(num,1) : ELSE num = p(num,2)
280 END IF
290 END REPeat ask