ARCADE GAMES CODED IN 1 LINE! All of the below games fit within a single line of ZX-BASIC code. They also fit within the single screen limit so that none of the listings scroll when LIST-ed on a 48K spectrum. Load the tape then select a game from the main menu and it will load and run automatically. Click on any of the below links for relevant game documentation. The game Mutant Fungi was developed solely by Einar Saukas. All of the other games were developed by Digital Prawn and Einar Saukas. Worm Battle PvP is a 2 Player game (Player versus Player). All other games are single player. Batmaster In-game screen. Program listing on 48K Spectrum. Text Listing 1 BORDER 3: POKE 23693,0: LET l=0: LET x=8: CLS : LET s=0: FOR d=-4 TO 0: FOR c=-7 TO 0: PRINT AT d+7,28+c*4; PAPER 1-c-d-6*(c+d<-5),: NEXT c: NEXT d: LET a=x+1: LET b=16: RESTORE : READ o$,o,q,k,g,x: PRINT AT 19,o;" " AND o-x; INK 7;AT 19,x;o$;o$;o$: READ e,f,p,c,z,c,d,t,a,b,h,w,s,u,l: PRINT AT f+d,4*INT ((e+c)/4);" " AND h;AT f,e;" "; INK 7;AT b,a;"o"; PAPER 2;AT 0,0;(l-u)*40+s,"L:";l+1,: BEEP w+(z OR p)/50,24*(h-w): POKE (w=0)*23620,14-9*u: DATA CHR$ 131,x,IN 61438-174,q-64*(q>17),(k=9)+2*(k=8)-(k<2)-(k=0),x+g*(x+g<30)*(x>=-g),a,b,(e=0)-(e=31),c+2*p,ATTR (b-d,a+c)>0,c-2*c*(f=18)*(e+c+c=x+1)*(p=0),d-d*2*(z+(f=18)*(e=x+1+c)),ATTR (b-d,a+c)=0,a+c*t,b-d*t,z*(f<9)*(f>1),b=21,s+h,s=40,l+u About the game A simple breakout clone coded in one line. Keys are 6-left, 7-right, 0-move bat at double speed. Object of the game is to clear all the bricks on each screen and achieve as many points as possible. Each brick is worth one point. The status line at the top of the screen shows the current score and level number. Each level has forty bricks. You can guide the ball to the left or right by hitting the very corner of the bat onto it. Again, many thanks to Einar Saukas for greatly improving the game via a multitude of optimisations and game ideas, not to mention numerous serious bugfixes. Technical Notes Writing a simple BASIC breakout clone in one line was not quite as easy as I first thought. There were two problems to overcome. The first problem is what I call "bishops on a chessboard". That is, if the ball is only permitted to travel diagonally then it will only visit half of the squares on the character mapped screen. So, if the bricks are only one character wide, then only half of them can be reached by the ball. A simple solution is to make the bricks two squares wide, or wider. In this game, the bricks are 4 squares wide, so they can all be reached by the ball. Second problem was collision detection between ball and bat. If ATTR() is used for collision detection like in this game, then if you print the ball and bat in the same statement, you may find that the ball often goes right through the bat. This is because both the ball and bat have moved on the same iteration, and the collision detection has missed them passing each other. The workaround used in this game is to firstly PRINT the bat, and then check collision with the ball before allowing the ball to move or bounce off, and then PRINTing the ball in a seperate statement. One other problem was collision detection with the bricks. In an earlier version of the game, sometimes two bricks could be destroyed in one iteration, but only one point would be added to the score in that case. This issue was resolved by Einar, in order to pave the way for a multi-level game. Later, after more space had been freed up in the program listing, a side-bounce effect was added allowing the player to redirect the ball left or right if hit directly on the corner of the bat. Eventually the bat size was reduced from 4 to 3 to make this side-bounce effect symmetrical, and the game a little harder. Finally the PAPER colour for the status row was changed to red, so it actually looks like the ball is bouncing off something at the top of the screen, and the sound effects were slightly refined. The end result is a program listing that is one character short of the one-liner competition limits. Batmaster 2 In-game screen. Program listing on 48K Spectrum. Text Listing 1 DATA CODE INKEY$,x+(k=55)*(x<27)-(k=54)*(x>0),b,f=17,(a=0)-(a=31),a+c+c+4*p=x+2,q*((a>x)*(a7): NEXT x: CLS : LET s=0: LET a=2*INT (x/2)+1: LET b=15: FOR d=-5 TO 0: FOR c=s-15 TO 0: PRINT AT d+7,c+c-s; INK d+6;CHR$ 144;CHR$ 145: NEXT c: LET s=1-s: NEXT d: PRINT PAPER 2;AT 21,0;" Score:";l*93+s," Level:";l+1,: RESTORE : READ k,x: PRINT AT 18,x;b$: READ f,q,p,r,v,c,d,a,b,z,d,w,s,t,l: PRINT AT f,a-c;" ";AT b,a;"o";" " AND z: BEEP w+(z+v OR p)/50,24*z: POKE (w=0)*23620,21-z-10*t About the game Einar Saukas decided to take the earlier game Batmaster as a starting point and develop this sequel from it which features quite a few improvements over the original. The keys are 6 - left, 7 - right. In this version, the bat has only one speed making it more challenging than the original. Just like in any other breakout clone the goal is to hit the ball with the bat, using it to knock out all of the bricks in the level. You only have one life. The horizontal ball direction may be reversed by hitting it right on the corner of the bat. On completing the level, a new level of bricks will appear, and the game continues. Technical Notes Firstly, the bricks in the game are UDG characters which Einar cleverly POKEd by using a mathematical expression, rather than the more usual DATA arrangement. It had to be done like this as RESTORE/READ/DATA is already in use within the main game loop. This game runs faster than the original partly due to removal of the two speed bat feature. This allowed erasing of the bat to be combined with the printing of the bat, and eliminated a couple of variables. Also, erasure of hit bricks was simplified. Further speed improvements were found and tested with the help of the profiling feature of the BASin development environment. Finally the score line was moved down to the bottom of the screen, as ATTR is no longer used for testing the top screen bounce in this version. The parameters for this game are 93 bricks per level, brick width is 2, bat width is 3 character positions. Biscuit Snake In-game screen. Program listing on 48K Spectrum. Text Listing 1 BORDER 2: POKE 23693,7: CLS : LET m=704: LET s=0: LET t=1: LET h=3: LET d=0: LET p=9: LET q=9: LET n=1: LET w=0: LET c=0: DIM x(m): DIM y(m): FOR i=t TO h: LET x(i)=15: LET y(i)=15-i: PRINT AT y(i),x(i); INK 6;"o\@"(1+(i=h)): NEXT i: RESTORE : READ v,w,i,k,d,d,x,y: IF (x>-1)*(x<32)*(y>-1)*(y<22) THEN READ u,e,p,q,s,f,n: PRINT AT y(t),x(t);" " AND f=0;AT 0,0;s; INK n;AT q,p;"O"; INK 6;AT y(h),x(h);"o";AT y,x;"\@": BEEP .01,24*e: READ h,x(h),y(h),c,t: POKE (u<>6)*23620,21: DATA .5+w*30-p,i,RND,CODE INKEY$,d+(k=54)-(k=55),d+8*((d<0)-(d>7)),x(h)+(d>4)-(d<4)*(d>0),y(h)+(d>2)*(d<6)-(d<2 OR d=7),ATTR (y,x),u<6,p+e*v,q+e*(.5+w*20-q),s+e*u,c>0,n+e*(.5+i*5-n),1+h*(h1);"#": NEXT a: NEXT b: LET a=NOT a: POKE n*a,22-3*(INKEY$="0">x): LET g=RND*28+1.5: LET z(g)=z(g)+(RND>r AND z(g)): PRINT AT z(g),g; INK 4;"#" AND z(g)>1: POKE n,24: BEEP .007,10: LET x=16: LET y=c+2: LET c=c+(INKEY$="7")*(c<27)-(INKEY$="6")*(c>0): PRINT AT 18,c; INK 5;" ";CHR$ 140;CHR$ 143;CHR$ 140;" "' INK 0; PAPER 6,p,: POKE n*(x=0),33: LET k=z(y)1)): POKE n*k,32: BEEP .02,-10: LET b=b-(x=1): LET p=p+1+99*(x=1): LET z(y)=x-1: LET x=k*(x-1): POKE n*(z(g)<18),5+8*(b>2): DATA 23620,1,0,0,14 Backstory In the Martian caves, a radioactive accident involving the latest archeological expedition triggered the rapid proliferation of the frightening Mutant Fungi! Exterminate all fungi growing from the ceilings of progressively more dangerous caves otherwise they will block the tunnels and eliminate any chance to rescue the surviving archeologists. About the game Your goal is to eliminate the mutant fungi infection inside the Mars caves. Each fungi section will be continuously growing until you destroy its root. (Sure we all know regular fungi don't have roots but remember those are mutant fungi!) The keys for this game are 6-left, 7-right, 0-fire, or a Sinclair joystick. You gain 100 points for each fungus root destroyed and only 1 point for other fungus parts, so your better chance for a high score is to eliminate as many roots as possible, instead of wasting time by shooting the same root section repeatedly. Credits This one-line game was written by Einar Saukas, converted from a BASIC game he originally co-produced with Eduardo Issao Ito over two decades ago (released as part of the collection "Jogos BASICOS vol.2"). Worm Battle PvP In-game screen. Program listing on 48K Spectrum. Text Listing 1 BORDER 3: POKE 23693,7: CLS : DIM t(2): DIM d(2): DIM c(2): DIM x(2,704): DIM y(2,704): LET h=1: LET x(1,1)=3: LET x(2,1)=28: LET y(1,1)=11: LET y(2,1)=11: LET d(2)=4: LET v=0: LET z=1: LET w=RND: LET g=1+h*(h<704): FOR r=1 TO 2: RESTORE : READ d,d,x,y,u,f,t: POKE (x<0 OR x>31 OR y<0 OR y>21 OR u<3)*23620,28: PRINT AT y(r,t),x(r,t);" " AND f=0;AT .5+w*20,.5+v*30; INK 6;"O" AND z=6; INK r;AT y,x;"o": READ x(r,g),y(r,g),c(r),t(r),d(r),z: NEXT r: READ h,v: POKE 23620,17: BORDER 3-r: DATA d(r)+SGN (IN (67582-3072*r)-IN (69630-6144*r)),d+8*((d<0)-(d>7)),x(r,h)+(d>6 OR d<2)-(d>2)*(d<6),y(r,h)+(d>4)-(d<4)*(d>0),ATTR (y,x),c(r)>-2,t(r)+1,x,y,c(r)+(u=6)*(3*w+1)-f,(t-f)*(t<704+f),d,z*(z<61)+1,g,w About the game Einar Saukas had the idea to take the previously written game Biscuit Snake and develop this two player game from it. The resultant game was a collaborative effort between Einar Saukas and Digital Prawn. This is the first two player game we have put together for the one line competition. Keys can be chosen from any of the following:- Player 1: 1,2,3,4,5 - turn left, q,w,e,r,t - turn right. Player 2: y,u,i,o,p - turn left, 6,7,8,9,0 - turn right. In this game, each player controls a different coloured worm, blue for player 1, red for player 2. The object is to survive longer than the other player. The player's worm gets killed either if (a) it hits the edge of the screen, (b) if its head hits the other worm, or (c) if its head hits part of its own body. Biscuits appear on the screen at random positions, at regular intervals. If a worm eats a biscuit, then its length will increase by a small random number of segments. This is advantageous to the player, as controlling a longer worm will give a greater chance of trapping the opponent, or inducing him to crash into you. When a player's worm gets killed, the game ends and the border colour changes to indicate the winner. The colour turns blue if player 1 has won, or red if player 2 has won.