"Guess" BASIC Program


The aim of this program was to produce a very basic 'Guess the Number' Game.


You choose the highest and lowest value that the random number should fall within.
Then how many tries you think it will take you to discover the correct figure.

Entering the correct figure will produce a sound effect and ask if you want another go.

Entering the wrong figure will again produce a less than congratulatory sound effect
and tell you that you have x-amount of guess's to try again.
The program will also tell you if you need to guess higher or lower in value.

Here is the 1986 listing for GUESS in BBC BASIC


10 REM GUESS
20 REM
30 REM GUESS THE NUMBER
40 REM
50 REM By RICHARD HALL
60 REM
70 REM Written on the:
80 REM
90 REM Acorn Electron 32K
100 REM
110 REM Language:BBC BASIC
120 REM
130 MODE 6:VDU19,0,4,0,0,0
140 *KEY10 OLD|M|G RUN|M
150 PRINT:PRINTSPC(10);"GUESS THE NUMBER"
160 PRINTSPC(10);"----- --- ------"
170 PRINT:PRINT
180 INPUT "LOWEST";low
190 INPUT "HIGHEST";high
200 correct=rnd(high)
210 IF correct<low THEN GOTO 200
220 P%=1
230 PRINT:INPUT"HOW MANY GUESSES (1 MIN. - 20 MAX.)";guess
240 IF guess<=0 OR guess>=21 THEN RUN
250 FOR round=guess-1 TO 0 STEP -1
260 IF round=-1 THEN GOTO 310
270 INPUT "GUESS ?";answer
280 IF answer=correct THEN GOTO 360 ELSE PROCno
290 P%=P%+1
300 NEXT round
310 PRINT "THE CORRECT NUMBER WAS: ";correct
320 PRINT:INPUT "ANOTHER GO (Y/N)";another$
330 IF another$="N" OR another$="n" THEN END ELSE CLEAR:RUN
340 REM
350 REM PROCEEDURES
360 REM
370 ENVELOPE 1,2,2,2,2,2,2,2,2,2,2,2,3,2
380 SOUND 1,1,50,25
390 PRINT:PRINT"CORRECT!!!":PRINT"YOU HAVE SUCCESSFULLY CHOSEN THE "'"NUMBER ";correct;" IN ";P%;" GOES."
400 PRINT:INPUT"ANOTHER GO (Y/N)";another$:IF another$="N" OR another$="n" THEN REPORT: END ELSE CLEAR:RUN
410 DEFPROCno
420 SOUND 0,-15,4,5
430 PRINT "WRONG!! YOU HAVE ";round;" GUESSES LEFT"
440 IF answer>correct THEN PRINT "TRY A LOWER NUMBER":ELSE PRINT "TRY A HIGHER NUMBER"
450 ENDPROC

Back to School Programs Page


If you have arrived here from a Search Engine
Click the link below to go to the Classic Acorn Home Page
Everyone else use the Navigation Section on the Left
<---------------------------------------------------

Home