Date : Wed, 09 Feb 2005 13:43:57 +0000 (GMT)
From : Brian Widdas <brian@...>
Subject: Re: Programming tips.
On Wed, 9 Feb 2005, Richard Gellman wrote:
> 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
Delete 55 and 56
> 58 REPEAT
> 60 REPEAT
> 70 PRINT "GUESS: ";
> 80 INPUT LINE G%
> 90 IF G%=B% THEN Q%=0
Delete line 90
> 100 IF G% > B% THEN PRINT "TOO BIG"
> 110 IF G% < B% THEN PRINT "TOO SMALL"
> 120 IF G% = 0 THEN Q%=1
Delete line 120
> 130 UNTIL Q%
130 UNTIL G% = Q% OR G% = 0
> 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
240 UNTIL (ASC(Y$) AND &DF) <> ASC("Y")
> 250 UNTIL E%
Delete 250
Alternatively...
220 REPEAT K%=GET AND &DF: UNTIL K% = ASC("Y") OR K% = ASC("N")
230 UNTIL K% = ASC("N")
240
250
Oh, and run RENUMBER
Brian
--
* * * * ** * * ** ** * *
* ** * * ** * * * *
* * * * * *