ACTION 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. SKIER was developed solely by Einar Saukas. All of the other games were developed by Digital Prawn and Einar Saukas. City Bomber In-game screen of City Bomber Program listing on 48K Spectrum Text Listing 1 READ i,j: FOR f=0 TO 39: READ d: POKE USR "a"+f,d: NEXT f: BORDER 5: POKE 23693,41: CLS : FOR m=1 TO 99: FOR a=10 TO 27: FOR b=-9 TO -RND*8: PRINT INK 2*(b>-9);AT 12-b,a;CHR$ (144+b/17);AT 11-b,a;CHR$ 145: NEXT b: NEXT a: FOR y=1 TO 20: FOR x=1 TO 25+4*(y<20): LET j=(j+1)*(j>0)*(j<21)+(INKEY$>"")*(j=0)*y: LET i=i+(x+1-i)*(j=0): LET c=ATTR (y,x+3)>41: PRINT AT j-(j>0),i;" ";AT j,i;CHR$ 148 AND (j>0)*(j<21);AT y,x;" "; FLASH c;CHR$ 146;CHR$ 147: BEEP .01+c,d-j-f*c: IF c=0 THEN NEXT x: PRINT AT y,28,: NEXT y: PRINT INK 0;m;" landed": BEEP .5,14: BEEP .5,16: BEEP .5,18: NEXT m: DATA 0,0,-1,159,d,d,-1,243,d,-1,0,24,60,126,-1,243,d,-1,0,48,120,124,127,d,63,0,0,0,0,0,-4,-2,-4,0,0,60,24,d,60,d,d,24 About the game This game is a one-liner version of a well-known game seen in a computer type-in book from the '80s. The game features sound and a significant number of UDGs. The game concept is so simple, which makes it a natural one-liner. There was no danger of exceeding the limit of a single screen of program listing, and as such I was able to be quite liberal with the use of code. Einar Saukas was able to add numerous improvements to this version of the game. Rules of the Game Your aeroplane flies across the screen from left to right, getting lower with each successive pass. Press any key to drop a bomb on the city. You can only have one bomb at a time. To win the game, destroy all buildings, and land the plane safely on the solid ground. If your plane hits the side of a building then the game ends. Try again with the RUN command. After you have landed safely, you now go on to bomb another city, and can increase your score. Sheepdog Trials In-game screen of Sheepdog Trials. Program listing on 48K Spectrum. Text Listing 1 POKE 23693,33: CLS : DIM x(8): DIM y(8): LET o=0: FOR t=1 TO 8: LET x(t)=4: LET y(t)=9+t: PRINT INK 0;AT 6+t,11;"#";AT 6+t,19;"#";AT 7+7*(t>1),12;"#######": NEXT t: LET k=CODE INKEY$-48: LET o=o+(1-2*o)*(k=0)*(ABS (32*y(1)+x(1)-239)>1): LET s=0: FOR a=1 TO 4: RESTORE : READ u,g,h,s,r,i,j,c,x(a),y(a): PRINT AT 0,0;509-t,AT 7,14; INK o;"=== "(3*o+1 TO 3+3*o*(k=0));AT h,g; INK 1;" ";AT y(a),x(a); INK 2+5*u;"m@"(1+u): NEXT a: POKE (s<3 OR o)*(t<509)*23620,10: DATA a>1,x(a),y(a),s+u*(g>11)*(g<19)*(h>7)*(h<14),RND*4,(a=1)*((k=7)-(k=6))+u*((r<2)*SGN (g-x(1))+(r>2)*SGN (r-3)),(a=1)*((k=8)-(k=9))+u*((r>2)*SGN (h-y(1))+(r<2)*SGN (r-1)),ATTR (h+j,g+i)=33,g+i*c*(g+i>0)*(g+i<31),h+j*c*(h+j>0)*(h+j<21) About the game Your job is to guide the red sheepdog around the field in order to herd the three white sheep into the pen, and close the gate. The sheep will avoid the sheepdog as much as possible, so tend to walk in the direction away from the sheepdog, although they also have some random element to their movements. You have a limit of 500 moves to win the game, making it a real challenge. Rules of the game:- Keys are Sinclair Joystick in Port 1, or 6-left, 7-right, 8-down, 9-up, 0/fire-open & close gate To win the game, trap all three sheep in the pen with the gate closed. You will get the Sinclair basic "OK" message when the game has been won. This must be done before the counter reaches zero. Only one key may be pressed at a time due to the use of INKEY$. The game is a little slow so may have to hold keys down for a second or so to get a response. Skier In-game screen of Skier. Program listing on 48K Spectrum. Text Listing 1 POKE 23693,56: BORDER 7: CLS : RESTORE : FOR f=0 TO 39: READ c: POKE USR "a"+f,c: NEXT f: LET t=300: FOR m=1 TO 1e9: LET r=RND: LET i=(INKEY$="7" AND c<30)-(INKEY$="6" AND c>1): LET c=c+i: LET x$=SCREEN$ (9,c): LET g=(15 AND x$="_")+(3 AND x$="."): LET h=x$="": LET t=t+g-1: PRINT AT 8,c-i;" ";AT 0*USR 3582+8,c; FLASH h;CHR$ (147+i); FLASH 0;AT 0,0;m;"m";AT 0,28;t;"s";AT 21,RND*29+1; INK 3-2*(r>.1);CHR$ (46+98*(r>.1));AT 21,29*r; INK 2;CHR$ 145+"_"+CHR$ 145 AND PEEK 23672<14: BEEP .02+h,g-9*h: BEEP h,-30: IF t-t*h THEN NEXT m: DATA 8,28,42,93,42,73,8,8,16,28,30,31,16,c,c,c,18,c,36,124,190,37,72,c,36,c,c,126,189,36,c,c,72,c,36,62,125,164,18,c About the game Your goal is to reach as far as possible skiing down a mountain before the countdown is over. You can gain time extensions by passing through the flags placed at regular intervals. There are also some small coloured bonus items scattered around the mountainside at random, collecting them will also grant you smaller time extensions. The keys for this game are "6" - left, "7" - right, or a Sinclair joystick. Backstory There's no story really. We have no good excuse for the coloured stuff spread all over the place, neither a reason for the time limit. You are welcome to use your own imagination and figure out a proper explanation yourself! Technical Details The game features user defined graphics for the player character and in-game scenery. It easily fits into the one-liner space limits, whilst providing a straightforward and easy-to-read source listing, which is uncommon for one-liners. Due to its reduced size, there was enough space left to even include performance optimizations, such as using boolean operators instead of the (shorter) mathematical equivalents, and some extra code to minimize the number of calls to the slower function RND. The fast vertical scrolling is achieved by directly calling the built-in ROM routine at 3582/$0DFE. 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.1"). Titan Lander In-game screen of Titan Lander Program listing on 48K Spectrum Text Listing 1 DEF FN r(x)=IN x<>191 AND IN x<255: BORDER 0: POKE 23693,50: CLS : PRINT AT 20,0; INK 1;"~~~~~~~~~~~~~~TTT~~~~~~~~~~~~~~~": READ x,y,c,w,f: FOR v=0 TO 7: READ k: POKE USR "a"+v,k: NEXT v: FOR i=0 TO 1: BEEP .01,y/4: LET o=x: LET p=y: LET a=(f>0)*FN r(32766): LET b=(f>a)*(FN r(57342)-FN r(64510)): LET f=f-a-b*b: LET v=v+b+c/5: LET w=w+.5-a: LET x=x+v+158*((x+v<0)-(x+v>157)): LET y=(y+w)*(y+w>0): PRINT AT p/5,o/5,AT y/5,x/5;CHR$ 144;AT 21,0;"Fuel:";f,"Wind:";INT ABS c;"><"(1+(c<0));"< >"(2+(c>-3)-(c<3)),: LET w=w*(y>0): LET c=c+RND-.5: LET i=y>92: NEXT i: LET l=ABS v+ABS w<3*(x>67)*(x<83): PRINT AT 9,11-3*l;"You ";"CrashedLanded Safely"(1+l*7 TO 7+l*13): DATA 9,0,0,0,99,24,60,k,k,24,k,102,231 About the game "Titan Lander" is a simple moon lander style game. Your goal is to land the spacecraft safely on the landing pad in the middle of the screen. This task is made more difficult by variable crosswinds, which buffet your craft around. Rules of the Game The keys are t - left thruster, y - right thruster, m - fire upward thruster. Multiple simultaneous key presses are allowed, due to the use of the IN() command. The lander has to land VERY slowly in order to succeed. To complete the game - land successfully, and see the "You Landed Safely" message. You have a limited amount of fuel and variable crosswinds can buffet the lander about, making it trickier to control. The speed and direction of the crosswind are indicated by a number, and directional arrows. There is a land proximity warning sound that increases in pitch as your altitude decreases. The Story The year is 2398. You, as a captain of an interplanetary craft have to deliver a desperately needed cargo of vodka to the colonists of New Moscow on Saturn's largest moon, Titan. Your craft has been damaged by an electrical storm in the upper atmosphere, and the auto navigation and landing systems have unfortunately failed at the last moment. You now must land the craft manually. Under manual control, only one of your four thrusters can be fired at a time. Treacherous crosswinds in the thick Titanian atmosphere do not make your mission any easier. Your goal, to land safely on the landing pad of the colony, in order to deliver the crucial vodka shipment. Once you receive the "You Landed Safely" message, you can consider yourself to have completed this game. Reward - treat yourself to a glass of vodka. You may successfully complete the game as many times as you wish.