=============
SOKO-BAN LINE
=============

SOKO-BAN LINE contains 10 "one-liner" SOKO-BAN levels. Each
level is a standalone BASIC program implemented in a single
line of code.

Obviously games implemented as one-liners can only provide
a minimum core gameplay. There is never enough space left
to support sophisticated presentations and other features
typically encountered in full-sized games. Their real
interest rests on the technical solutions applied in order
to fit a fully playable game, with custom graphics and
sound, in a single line of code with limited size.


=======
HISTORY
=======

According to the Jargon File, creating "one-liners" is a
popular tradition in computer science that started from APL
programmers in the 1960's.

In particular, implementing a "one-liner" in BASIC Sinclair
is very challenging, since the entire program must fit in a
single screen (22x32) otherwise it can't be properly edited
anymore.


========
CONTROLS
========

Use Sinclair Joystick keys (6 LEFT, 7 RIGHT, 8 DOWN, 9 UP)
to move and push boxes.

To restart a level, BREAK the program and RUN it again.

After solving a level, you can either reload the menu to
choose another one, or simply load and start the next level
in sequence by typing:

  LOAD ""
  RUN


=====
FILES
=====

The tape contains the following programs:

"SOKO-BAN LINE " - One-liner menu
"SB SKBONUS"     - One-liner level "SOKO-BONUS"
"SB AUTOG 1"     - One-liner level "AUTOGEN #1"
"SB AUTOG 2"     - One-liner level "AUTOGEN #2"
"SB AUTOG 3"     - One-liner level "AUTOGEN #3"
"SB AUTOG 4"     - One-liner level "AUTOGEN #4"
"SB AUTOG 5"     - One-liner level "AUTOGEN #5"
"SB AUTOG 6"     - One-liner level "AUTOGEN #6"
"SB AUTOG 7"     - One-liner level "AUTOGEN #7"
"SB AUTOG 8"     - One-liner level "AUTOGEN #8"
"SB AUTOG 9"     - One-liner level "AUTOGEN #9"

Each level can be loaded directly, although it's easier to
load the "one-liner" menu first, that provides assistance
to load any particular level.


============
TECH DETAILS
============

The source code for a typical SOKO-BAN one-liner in the
collection (in this case level "SOKO-BONUS") looks like
this:

  1 DEF FN z$(x)=CHR$ 22+CHR$ (9.5-x/w)+CHR$ (x-w*INT (x/w)):
  DEF FN m(x)=CODE m$(x)/4-8:
  DEF FN p$(x)=FN z$(x)+CHR$ 16+CHR$ FN m(x)+CHR$ (FN m(x)/2+144):
  DIM m$(99):
  READ m$(25 TO ),g:
  FOR w=-12 TO 11:
  READ n:
  POKE USR "b"+w+4,n:
  NEXT w:
  FOR z=-18 TO 53:
  PRINT FN p$(z+31):
  NEXT z:
  LET i=CODE INKEY$-48:
  LET d=w*((i=9)-(i=8))+(i=7)-(i=6):
  LET a=FN m(z+d):
  LET b=FN m(z+d+d):
  POKE g,18+4*(d*a*((a>2)+(b>2))=0)+(a>2):
  LET m$(z+d+d)="($"(1+b/7):
  LET z=z+d:
  LET m$(z)="<,"(.8*a-5*(a=7)):
  LET n=n-(a=2)+(a<3)*(b=3):
  PRINT FN p$(z-d);FN p$(z+d):
  PRINT FN z$(z);"o":
  BEEP (i>0)/w,a:
  POKE (n<4)*g,13:
  DATA "<<<<   ,,,  <$<<$<<<<   <$<< <<$,   <<",23620,0,-2,n,n,n,n,n,n,0,-2,n,198,n,n,-2,n,0,0,16,40,68,40,16,0


The source listing fits exactly in a single screen, which
is the maximum editable size for a program line in the
ZX-Spectrum:

     1 DEF FN z$(x)=CHR$ 22+CHR$ (
  9.5-x/w)+CHR$ (x-w*INT (x/w)): D
  EF FN m(x)=CODE m$(x)/4-8: DEF F
  N p$(x)=FN z$(x)+CHR$ 16+CHR$ FN
   m(x)+CHR$ (FN m(x)/2+144): DIM
  m$(99): READ m$(25 TO ),g: FOR w
  =-12 TO 11: READ n: POKE USR "b"
  +w+4,n: NEXT w: FOR z=-18 TO 53:
   PRINT FN p$(z+31): NEXT z: LET
  i=CODE INKEY$-48: LET d=w*((i=9)
  -(i=8))+(i=7)-(i=6): LET a=FN m(
  z+d): LET b=FN m(z+d+d): POKE g,
  18+4*(d*a*((a>2)+(b>2))=0)+(a>2)
  : LET m$(z+d+d)="($"(1+b/7): LET
   z=z+d: LET m$(z)="<,"(.8*a-5*(a
  =7)): LET n=n-(a=2)+(a<3)*(b=3):
   PRINT FN p$(z-d);FN p$(z+d): PR
  INT FN z$(z);"o": BEEP (i>0)/w,a
  : POKE (n<4)*g,13: DATA "<<<<
  ,,,  <$<<$<<<<   <$<< <<$,   <<"
  ,23620,0,-2,n,n,n,n,n,n,0,-2,n,1
  98,n,n,-2,n,0,0,16,40,68,40,16,0


It was necessary to apply innumerous tricks to reduce the
program size, so all the intended functionality would fit
in a single line of code. Many variables are reused for
multiple purposes, in order to avoid the extra space
required for declaring each one. The SOKO-BAN level is
encoded in a one-dimensional array to save space, then
converted later to 2 dimensional coordinates at the time
its contents are printed on screen. In this particular
case, the level even had to be stored upside down just to
save a few extra characters.


=======
CREDITS
=======

Freeware "SOKO-BAN LINE" for ZX-Spectrum & compatibles.
Produced by *ZX-SOFT* Brasil Ltda.
Programmed by Einar Saukas.

Original SOKO-BAN concept by Hiroyuki Imabayashi.
AUTOGEN levels designed by Yoshio Murase.
SOKO-BONUS level designed by Einar Saukas.

This game was loosely based on the SOKO-BAN version for the
ZX-Spectrum originally produced by *ZX-SOFT*, implemented
by Einar Saukas & Eduardo Issao Ito.
