Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2528

miscellaneous new bbc and electron games • Chicken - a game in 10 lines of BASIC

$
0
0
Here is my entry for this year's BASIC 10Liner Contest PUR-80 category (maximum 80 characters per line).

CHICKEN
You are in the path of an oncoming train. You have three seconds to jump out of harm's way by pressing 'Y'. Score as much as you can over five rounds by jumping as late as you dare. The later you jump, the more you score. Jump too late and you lose all the points you have gained. Ready to play? What's the matter, you chicken?

Code:

0MODE7:@%=&20209:VDU23,1,0;0;0;0;:ENVELOPE1,3,0,16,12,1,1,1,126,-10,0,-10,126,01S=0:C=0:R=1:PRINTTAB(8,14)"Score "STR$C''SPC8"High Score "STR$H%TAB(8,4)"ROUND"2FORN=6TO12:PRINTTAB(6,N)SPC18TAB(14,4)STR$R''SPC8:NEXT:FORN=1TO1500:NEXT3PRINTTAB(8,6)"Train coming"''SPC8"PLAY CHICKEN?"''SPC8"Impact in":TIME=0:T=34Y=INKEY-69:IFY=-1:E=TIME:PRINTTAB(18,10);ABS(T-E/100)''CHR$(130);SPC7;:GOTO75IFTIME>300:GOTO6:ELSEPRINTTAB(18,10);ABS(T-TIME/100):GOTO46PRINTTAB(18,10);0TAB(7,12)CHR$(129)"SQUISH":C=0:S=0:SOUND0,-15,2,5:GOTO87IFE>=300:GOTO6:ELSE S=10000/(300-E)DIV1:SOUND1,1,80,2:PRINT"YOU SCORED "STR$S8C=C+S:R=R+1:PRINTTAB(14,14)STR$C SPC4:FORN=1TO3000:NEXT:IFR<6GOTO29PRINTTAB(8,18)"END":REPEATUNTILINKEY(0)=-1:K=GET:IF C>H% H%=C:GOTO0:ELSE GOTO0
This has been a lot of fun to make and the challenge to boil it all down to 10 lines of 80 characters, has actually improved the workings of the game, I think. Writing a detailed breakdown of the code definitely helped me to optimise it further and move it from the PUR-120 into the PUR-80 category. You can read my write-up here: https://bunsen.itch.io/chicken-bbc-micro-by-keyscompany

This is only the first game I've ever put out into the world so please go easy. I dare say that many of you here could have achieved this with way less code and I'd love to here if anyone has any suggestions for improvements. Please post you high scores as well.

Here's the disc

Statistics: Posted by keyscompany — Sat Apr 05, 2025 3:48 pm



Viewing all articles
Browse latest Browse all 2528

Trending Articles