10 REM NUTS by ART
20 DIM leg$(2),wire(89,2):hiscore=0:e$=CHR$(27):cls$=e$+"E"+e$+"H"
30 u$="_":ul$=STRING$(84,u$)
40 p$="PLAY AGAIN (Y/N)?":con$=CHR$(10)+STRING$(4,8)
50 leg$(0)=CHR$(47)+u$+CHR$(149)+u$:leg$(1)=CHR$(149)+u$+CHR$(92)+u$
60 body$=CHR$(188)+CHR$(143)+"  ":head$=" "+CHR$(127)+"  "
70 DEF FNat$(x,y)=e$+"Y"+CHR$(32+y)+CHR$(32+x)
80 DEF FNcen$(y)=FNat$((90-(LEN(b$)+LEN(bb$)))\2,y)+b$+bb$
90 DEF FNal$(x,y,l)=FNat$(x,y)+head$+con$+body$+can$+leg$(l)
100 DEF FNch$(x,y)=FNat$(x,y)+CHR$(188)+CHR$(8)+CHR$(10)+CHR$(32)
110 DEF FNva$(x,y)=FNat$(x,y)+"    "+con$+"    "+con$+"____"
130 PRINT cls$:y=0:WHILE y<20:READ y,b$,bb$:PRINT FNcen$(y):WEND
140 k$="":WHILE k$="":r=RND:k$=INKEY$:WEND:
150 shy=INT(RND*40)+60:score=0:scr=18:PRINT cls$;eS+"f"
160 FOR n=0 TO 89:wire(n,1)=0:wire(n,2)=2:NEXT
170 throw=1:l=1:rise=0:k$=""
180 scr=scr-2:qty=INT(RND*9)+6:PRINT cls$;FNat$(3,2)ul$;FNat$(3,28)ul$;
190 PRINT FNat$(35,1)"Hiscore = ";hiscore;FNat$(5,1)"Score = ";score;
200 PRINT FNat$(71,1)"Shies left = ";shy;
210 FOR n=1 TO qty
220 wix=INT(RND*80)+5:IF wire(wix,1)=1 THEN GOTO 220
230 wire(wix,1)=1:wiy=INT(RND*7):wire(wix,2)=wiy+scr:FOR y=3 TO (wiy+scr)
240 PRINT FNat$(wix,y)CHR$(149):NEXT:PRINT FNat$(wix,y)CHR$(187):NEXT
250 y=26
260 FOR x=85 TO 1 STEP -1:ON throw GOSUB 360,390:IF shy=0 THEN GOTO 290
270 IF qty=0 THEN GOTO 160
280 PRINT FNal$(x,y,l):l=1+(l=1):NEXT:PRINT FNva$(x,y):GOTO 250
290 b$=" GAME ":bb$="OVER ":IF score>hiscore THEN hiscore=score
300 PRINT FNat$(45,1)hiscore;e$+"p";FNcen$(y-1);e$+"q":PRINT FNva$(x,y)
310 FOR n=1 TO 17:x=51-n:body$=" "+CHR$(143)+" "+MID$(p$,18-n,1)
320 PRINT FNal$(x,y,1):l=l+(l=1):NEXT:x=x-1:PRINT FNva$(x,y)
330 k$="":WHILE k$="" OR (k$<>"Y" AND k$<>"N"):k$=UPPER$(INKEY$):WEND
340 body$=CHR$(188)+CHR$(143)+"  ":IF k$="Y" THEN GOTO 150
350 PRINT cls$;e$+"e";e$+"q":END
360 k$=INKEY$:IF k$<>" "THEN RETURN:REM Space-bar or not?
370 throw=2:body$=" "+CHR$(143)+"  ":head$=CHR$(188)+CHR$(127)+"  "
380 rise=1:RETURN
390 IF rise=1 THEN stx=x:head$=" "+CHR$(127)+"  ":yy=25:rise=0
400 PRINT FNch$(stx,yy):yy=yy-1:IF yy<>wire(stx,2)THEN RETURN
410 score=score-(wire(stx,1)=1)
420 qty=qty+(wire(stx,1)=1):PRINT FNat$(13,1)score
430 PRINT FNat$(stx,yy+1)" ":IF wire(stx,1)=1 THEN wire(stx,1)=0
440 shy=shy-1:PRINT FNat$(84 ,1)shy
450 throw=1:k$="":body$=CHR$(188)+CHR$(143)+"  ":RETURN
460 DATA 2,"COCONUT ","SHY"
470 DATA 6,"Coconuts - all hanging down."
480 DATA "  Friend Algernon tries to hit them by throwing a rock"
490 DATA 8,"at them.  If he hits one he scores a point, "
500 DATA "but hit or miss, he doesn't get another"
510 DATA 10,"rock until the thrown rock has finished its course.  "
520 DATA "He throws a rock when you press"
530 DATA 12,"the Space-Bar.  Algernon has between 60 and 100 rocks.  "
540 DATA "When all the coconuts on"
550 DATA 14,"a screen have been hit, a new batch will arrive "
560 DATA "but the more screens are cleared, the"
570 DATA 16,"harder it gets because ","the coconuts go higher and higher."
580 DATA 20,"PRESS ANY ","KEY TO PLAY"
