Date : Wed, 09 Feb 2005 13:25:24 +0000
From : Richard Gellman <splodge@...>
Subject: Re: Programming tips.
ugh. :)
10 MODE 4
20 REM MAGIC NUMBER
30 REM BY THOMAS DRAGE - BBC BASIC
40 PRINTTAB(0,1);"WELCOME TO MAGIC NUMBER!"'"FOR BBC BASIC"'"BY THOMAS
DRAGE"'
50 B%=RND(20)
55 Q%=0
56 E%=0
58 REPEAT
60 REPEAT
70 PRINT "GUESS: ";
80 INPUT LINE G%
90 IF G%=B% THEN Q%=0
100 IF G% > B% THEN PRINT "TOO BIG"
110 IF G% < B% THEN PRINT "TOO SMALL"
120 IF G% = 0 THEN Q%=1
130 UNTIL Q%
140 IF G% = 0 THEN PRINT "GOODBYE!":END
150 CLS
160 GCOL 0,1
170 MOVE 200,300
180 DRAW 250,250
190 DRAW 460,575
200 PRINTTAB(18,6),"CORRECT!"
210 PRINTTAB(18,9),"AGAIN? Y OR N";
220 INPUT LINE Y$
230 CLS
240 IF (ASC(Y$) AND &DF) = ASC("Y") THEN E%=1
250 UNTIL E%
You'll find that runs a little smoother :)
-- Richard Gellman
Tom Drage wrote:
> I recently wrote a magic number program for my bbc b. I have
> programmed in other languages before, but no doubt my BASIC is terrible.
>
>
>
> If anyones got time would they have a look at the code
> www.members.iinet.net.au/~drage/other/magic.jpg
> <http://www.members.iinet.net.au/%7Edrage/other/magic.jpg> and suggest
> any better ways ic ould have gone about it.
>
>
>
> Thanks!
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 2/7/2005
>