CLASSIC 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. To run the games, type 'r' (i.e. RUN) after the game has loaded. Click on any of the below links for relevant game documentation. All of the games were developed by Digital Prawn and Einar Saukas. One Line Invaders 2: Mothership's Revenge In-game screen of Mothership's Revenge. Program listing on 48K Spectrum. Text Listing 1 DIM i$(3,7): FOR g=1 TO 3: LET i$(g)=" H H H": NEXT g: READ m,b,p,a,s,e,n: FOR y=0 TO 13: FOR x=e TO 26-e STEP 1-e/13: FOR i=1 TO 3: PRINT AT y-1+2*i,x,'TAB x;i$(i): NEXT i: LET z=(b>y)*(bx)*(a" ": LET q=(b=1)*(m>0)*2>ABS (a-m): PRINT AT 0,m;"<=>" AND m,,AT g-1,x+3;" ";AT g,x+4;"*";AT 21,0;s,,AT b+1,a;" ";AT b,a;"|" AND b-b*h;AT 20,p-1;" W ": IF x+3-p+g/20 THEN LET i$(k,l)="": LET s=s+h+5*q: LET p=p-(IN 645101)+(IN 573420)): LET a=a+(p-a)*(b=19): LET g=1+g+(g=21)*(y+4-g): LET m=(q=0)*(m-(m>0)): LET e=x: NEXT x: LET m=m+29*(e+RND<.5): NEXT y: DATA 0,0,14,p,0,26,255 About the Game Einar Saukas freed up enough space in the original "One Line Invaders" game to allow for some extra features. Take that as a starting point, add a mothership, apply further optimizations, change the graphics, and we have this sequel "Mothership's Revenge". Digital Prawn originally added the mothership, but Einar must take credit for doing most of the work on this one. He performed all of the extreme optimizations, to allow the game to fit with in the one-liner compo limit and implemented the new graphics. The Story As a commanding officer in the planet wide defense forces, you fought bravely when the chips were down in "One Line Invaders". You successfully defended the planet from a hostile attack, but little were you to know that the alien menace was about to regroup. This time they'd have the tenacity to attack during broad daylight! They are also getting braver than ever, with their mothership now entering the planetary system for the first time. Have you got what it takes to defeat them a second time? The planet needs YOU more than ever! Rules of the Game The keys are t - left, y - right, m - fire. Fire and a direction can be pressed at the same time. You only have one life. If you get shot, the game is over. You can only fire one missile at a time. The space invader's bomb moves sideways along with the invader fleet, so watch out for that! The invaders will cross the screen 14 times before the game ends. To complete the game, destroy all of the invaders before they land. Also destroy the mothership where possible. Each mothership destroyed is worth an extra 5 points. Important note on the program listing Due to limited space available in the above program listings, the method of keyboard reading is very simple, and does not mask off the 'ear' bit. Therefore the value of 'n' used to compare against the IN command (found at the very end of the program listing) may have to be changed to either 191 or 255 depending on the issue of the ZX spectrum in use, the internal state of a snapshot file, or the emulator and settings in use. Otherwise the keyboard may not respond. In this game compilation, the problem is avoided by having two versions of the program in the tape file. The correct version for your system automatically loads depending on a keyboard reading check performed by the menu program. One Line Invaders In-game screen of One Line Invaders. Program Listing on 48K Spectrum. Text Listing 1 READ t,b,p,a,s,e,n: BORDER 0: POKE 23693,7: CLS : DIM i$(3,9): FOR g=1 TO 3: LET i$(g)=" # # # #": NEXT g: FOR y=0 TO 13: LET e=24-e: FOR x=24-e TO e STEP e/12-1: FOR i=1 TO 3: PRINT AT y-1+2*i,x,AT y+2*i,x;i$(i): NEXT i: LET z=(b>y)*(bx)*(a" ": PRINT AT g-1,x+3;" ";AT g,x+4;"|";AT 21,0;s,,AT b+1,a;" ";AT b,a;"| "(1+h+(b=0));AT 20,p-1;" ^ ": IF x+3-p+g/20 THEN LET i$(k,l)="": LET s=s+h: LET p=p-(IN 645101)+(IN 573420)): LET a=a+(p-a)*(b=19): LET g=1+g+(g=21)*(y+4-g): BEEP .01,y+t: LET t=1-t: NEXT x: NEXT y: POKE 23620,32-30*(s/12=INT (s/12)): DATA 0,0,16,p,0,0,191 About the game Written in a single line of ZX BASIC, the game consists of a small fleet of 12 space invaders. The goal of the game is to shoot all 12 invaders down before they reach the bottom of the screen, and also to avoid getting shot yourself. In this multiple attack waves version, successive waves of invaders will appear. So you can try to get a score as high as possible. Rules of the Game The keys are t - left, y - right, m - fire. Fire and a direction can be pressed at the same time. You only have one life. If you get shot, the game is over. You can only fire one missile at a time. The space invader's missile moves sideways along with the invader fleet, so watch out for that! The invaders will cross the screen 14 times before the wave ends. To complete each wave, score 12 points and then keep playing against successive waves until you have achieved as high as score as possible. Watch out for the "invisible fleet" that continues firing bullets even after you have shot all invaders down. This can still kill you until it has reached the bottom of the screen. Important note on the program listing Due to limited space available in the above program listings, the method of keyboard reading is very simple, and does not mask off the 'ear' bit. Therefore the value of 'n' used to compare against the IN command (found at the very end of the program listing) may have to be changed to either 191 or 255 depending on the issue of the ZX spectrum in use, the internal state of a snapshot file, or the emulator and settings in use. Otherwise the keyboard may not respond. In this game compilation, the problem is avoided by having two versions of the program in the tape file. The correct version for your system automatically loads depending on a keyboard reading check performed by the menu program. Tiny Pacman Level one of Tiny Pacman. Here, the player is temporarily invulnerable after eating a '$' power pill. Level two of Tiny Pacman. Program listing on 48K Spectrum. Text Listing 1 BORDER 0: POKE 23693,1: CLS : DIM p(10): FOR l=0 TO 4: RESTORE : READ w,s,m$,m$: FOR t=1 TO 10: LET p(t)=85-9*t: PRINT AT t,0;m$(t*w-11 TO t*w): NEXT t: LET m$(p(1)+1)="": LET k=113-CODE INKEY$: FOR a=1 TO l+2: LET g=p(a): LET i=4*RND-2: LET i=(a=1)*((k=1)-(k=2)+w*((k=16)-(k=0)))+SGN i*(1+11*(i*i<1))*(g<>p(1)): LET c=CODE m$(g+i+1)-45: LET p(a)=g+i*(c<2)-i*(m$(g-i+1)<"O")*(c>1)*(a>1): PRINT AT g/w+.5,g-w*INT (g/w);m$(g+1);AT w,0;l*58+s;AT p(a)/w+.5,p(a)-w*INT (p(a)/w); INK 7-a*(t<1);"©@@@@@"(a): LET t=t-1+(c=-9*a)*(37-t): LET s=s+(a=c): IF a=1 OR p(a)-p(1) OR t>0 THEN NEXT a: POKE (s<56)*23620,w: NEXT l: DATA 12,1,"OOOOOOOOOOOOO...O......OO.O..OO.OO.OO.OO...$.O.OO....OO....",m$+m$(w TO )+m$ About the game The game consists of a 12x10 pacman type maze. The player must clear five levels and achieve a score of 280 points in order to complete the game. The first level has one ghost, the second level two ghosts, and so on up to the final level, level five. Due to space limitations of the one-liner contest, the ghosts simply move in a random direction one square at a time, and nothing like true Pacman type ghosts. This makes the later levels quite awkward, as the ghosts can often hover over the few remaining dots. Again, Einar Saukas was able to provide invaluable optimizations and ideas to improve the game greatly. Firstly this freed up enough space in the code to allow for two powerpills per level - which make pacman temporarily invulnerable. The other major change was to allow the ghosts two movement attempts per iteration. This made them far more maneuverable than in the original version. (There's also an intermediate version put together by Einar, which has better AI than the original instead of powerpills). Rules of the Game The keys are q,a,o,p layout (lower case only). Only one keypress registers at a time due to the use of INKEY$. You only have one life. If a ghost catches you, the game is over. Complete all 5 levels to win the game. There is an extra ghost in the maze for each successive level. The maximum score for the final version is 280 points. The final version has two power pills per level. These powerpills aren't worth any points, but do allow the pacman to become temporarily invulnerable. The length of time the invulnerability lasts gets less and less on each successive level. The Ghosts Ghost Name Comments @ Speedy Speedy appears as the sole ghost in the very first level. He is the fastest ghost in the game during level 1, but only because the game slows down on the later levels. @ Swampy First pops up in level two. Swampy likes to save the environment, and that means killing you reckless eater of dots. @ Dandy Now things start to get a little bit tricky. By the time Dandy turns up, there are three ghosts in the maze and they really start to get under your feet. @ Kenny By the time Kenny turns up on level four, the game really starts to slow down. Grabbing the last few dots can now become very tricky, particularly in the dead-end parts of the maze. @ Shadow Master of stealth, the best kept weapon of "tiny pacman" does not reveal himself until the very last level. Watch out carefully for this ghost, as he is the same colour as the maze, and can catch you unawares. Tiny Pacman 2: Pacman Strikes Back Level five of Pacman Strikes Back. Program listing on 48K Spectrum. Text Listing 1 BORDER 0: POKE 23693,1: CLS : DIM p(10): FOR l=0 TO 4: RESTORE : READ w,s,m$,m$: FOR a=1 TO 10: LET p(a)=85-9*a: PRINT AT a,0;m$(a*w-11 TO a*w): NEXT a: LET m$(p(1)+1)="": LET k=CODE INKEY$-48: FOR a=1 TO l+2: LET g=p(a): LET i=8*RND-4: LET i=(a=1)*((k=7)-(k=6)+w*((k=8)-(k=9)))+SGN (ABS i-2+SGN (p(1)-g))*(1+11*(i>0))*(g<>p(1)): LET c=CODE m$(g+i+1)-45: LET p(a)=g+i*(c<2)-i*(m$(g-i+1)<"O")*(c>1)*(a>1): PRINT AT g/w+.5,g-w*INT (g/w);m$(g+1);AT w,0;l*58+s;AT p(a)/w+.5,p(a)-w*INT (p(a)/w); INK 7-a;"©@@@@@"(a): LET s=s+(a=c): BEEP (a=1)/99,c/2+l*4: IF a=1 OR p(a)-p(1) THEN NEXT a: POKE (s<58)*23620,w: NEXT l: DATA 12,1,"OOOOOOOOOOOOO...O......OO.O..OO.OO.OO.OO.....O.OO....OO....",m$+m$(w TO )+m$ About the game The first sequel to the game "Tiny Pacman". This version is now more difficult since there are no powerpills to protect pacman. It's also more difficult as the AI for the ghosts is greatly improved. There's still a random element to their movement, but they will sometimes appear to follow the pacman during play. All concepts and implementation for this version were done by Einar Saukas, for which I am very grateful. Einar has added also sound to the game in this version, which varies depending on whether or not pacman is eating dots; also the pitch is changes with each level. Rules of the Game The keys for this game are Sinclair 1 joystick or keys 6-left, 7-right, 8-down, 9-up. Only one keypress registers at a time due to the use of INKEY$. You only have one life. If a ghost catches you, the game is over. Complete all 5 levels to win the game. There is an extra ghost in the maze for each successive level. The maximum possible score in this sequel is 290 points. The Ghosts Ghost Name Comments @ Speedy Speedy appears as the sole ghost in the very first level. He is the fastest ghost in the game during level 1, but only because the game slows down on the later levels. @ Swampy First pops up in level two. Swampy likes to save the environment, and that means killing you reckless eater of dots. @ Dandy Now things start to get a little bit tricky. By the time Dandy turns up, there are three ghosts in the maze and they really start to get under your feet. @ Kenny By the time Kenny turns up on level four, the game really starts to slow down. Grabbing the last few dots can now become very tricky, particularly in the dead-end parts of the maze. @ Shadow Master of stealth, the best kept weapon of "tiny pacman" does not reveal himself until the very last level. Watch out carefully for this ghost, as he is the same colour as the maze, and can catch you unawares. Tiny Pacman 3: Return of Pacman Level one of Return of Pacman. Here the bonus item '£' has appeared (worth two points). Program listing on 48K Spectrum. Text Listing 1 DIM p(10): LET b=0: FOR l=0 TO 4: RESTORE : READ w,s,m$,m$: FOR f=1 TO 10: LET p(f)=85-9*f: PRINT AT f,0;m$(f*w-11 TO f*w): NEXT f: LET m$(p(1)+1)="": LET k=CODE INKEY$-48: FOR a=1 TO l+2: LET g=p(a): LET u=g=28*(f>50): LET b=b+(a=u): LET f=f+1-1e9*u: LET i=8*RND-4: LET i=(a=1)*((k=7)-(k=6)+w*((k=8)-(k=9)))+SGN (ABS i-2+SGN (p(1)-g))*(1+11*(i>0))*(g<>p(1)): LET c=CODE m$(g+i+1)-45: LET p(a)=g+i*(c<2): PRINT AT g/w+.5,g-w*INT (g/w);m$(g+1);AT w,0;s+l*58+b*2;AT 3,4; INK a;"£" AND f>50;AT p(a)/w+.5,p(a)-w*INT (p(a)/w);"©@@@@@"(a): LET s=s+(a=c): IF a=1 OR p(a)-p(1) THEN NEXT a: POKE (s<58)*23620,10: NEXT l: DATA 12,0,"OOOOOOOOOOOOO..........OO..O OO.O..OO.O......O.OO...OOOO...",m$+m$(w TO )+m$ About the game The second sequel to the game "Tiny Pacman", and the final game in the "Tiny Pacman Trilogy". This version features the blue coloured 'son of pacman', and is set in a 'daylight' environment, to save space in the program listing. The object of the game is as before to clear all the dots in the maze, and avoid being eaten by the ghosts. However in this version there is a single bonus item on each level, worth two points, and it appears as a '£' pound sign. The bonus item does not appear right away, but when it does, you should grab it as soon as possible. If you don't, then a ghost may get there first, and deprive you of the two points. You can complete this game by beating all five levels, for a score of 290 points or above. However, to consider yourself a true champion of "Tiny Pacman Three: Return of Pacman", you must obtain the bonus on each of the five levels, and finish with a winning score of exactly 300 points. Many thanks again to Einar Saukas who developed the bonus concept of this game, implemented the coding techniques, and made it possible to fit into the single screen limits with extensive optimizations. Rules of the Game The keys for this game are Sinclair joystick 1 layout / keys 6-left, 7-right, 8-down, 9-up. Only one keypress registers at a time due to the use of INKEY$. You only have one life. If a ghost catches you, the game is over. Complete all 5 levels to win the game. There is an extra ghost in the maze for each successive level. The maximum possible score in this game is 300 points, if all bonuses are successfully taken.