One Line Space Trader

Initial Trading and Travel Portal screen.

Approaching the rebel planet Mars.

Program listing on 48K Spectrum.

Text Listing
1 POKE 23693,7:
 LET s=90:
 LET c=s:
 DIM g(9):
 DIM p(9):
 CLS :
 PRINT "$";c:
 FOR r=1 TO 9:
 LET p(r)=p(r)+(r<5)*(p(r)=0)*INT (r*(7+r/2+RND*5)):
 PRINT 'r;". ";"fuelfoodtechdrugTERAMARSIO  RHEAERIS"(r*4-3 TO r*4);" $";p(r),g(r):
 NEXT r:
 INPUT x,y:
 LET y=y*(y*p(x)<=c)*(g(x)>=-y):
 LET g(x)=g(x)+y*(x<5):
 LET c=c-y*p(x):
 POKE 23620*(x<5 OR x-y),6:
 INK x-4:
 FOR i=1 TO 40:
 BORDER 0:
 RESTORE :
 READ k,r,x,y,f,s,r:
 CLS :
 CIRCLE 72+x*8,32+y*8,i:
 PRINT s,AT 13.5+i/5-y,r+x-7;"X" AND r;AT 11,15;"*" AND k=0:
 BORDER 2*f:
 BEEP .1,24:
 NEXT i:
 DATA CODE INKEY$-48,r-INT (r/11)+2*(RND<.5) AND r,x+(k=6)*(x<15)-(k=7)*(x>-1),y+(k=8)*(y<13)-(k=9)*(y>1),i>10 AND r,s-f,r-r*(INT (i/5)+3=y)*(r+x=22)*(k=0):
 POKE 23620*(s>0),5

Download the game

About the game

An attempt to fit a space trading type game into a single line of code. One Line Space Trader features five visitable planets, enemy craft that attack the player and can be shot down. There's trading screen where goods can be bought and sold and from where travel to other planets can be made. Again, thanks to Einar Saukas for taking the time to look at optimisations and improvements to this game which made the full buying/selling system possible in a one-liner. The original version of the game for comparison is here. The decision was also made to change the game from interstellar to interplanetary in order to make the in-game planets and moons seem more familiar to the player on the trading menu.

Key, showing in-game features of trading screen.

Key, showing spaceflight graphics.

Game FAQ

Back to Sinclair stuff index