A downloadable game

10 Line BASIC 

=============

Category : PUR-80 

TITLE    : Fill The Box

PLATFORM : Oric Atmos

LANGUAGE : BASIC 1.1b

AUTHOR   : RAX


CODE:

---------1---------2---------3---------4---------5---------6---------7--------
0E$="####6I######'+'#'+#+'+'+##3%##+'S*####))_2_2))####);S&S&);####A)AA/A/)##"
1F$="#$1@##Z^S#)#&#V+#++,#+###'%$=2%4/4####31<13131####)#3\3#_B####+'Q@%3U3##"
2PING:LORES0:INK6:Q=14:W=6:D$=E$+F$:?@16,W+7;"Level:"L+1:PLOT15,4,"FillTheBox"
3POKE#26A,2:DEFFNC(X)=(DANDX)/X:GOSUB8:X=0:Y=5:P=23:REPEAT:PLOT14,W-2,P-16''''
4K$=KEY$:E=X:R=Y:IFK$>""THENK=ASC(K$):X=X-(K=9)+(K=8):Y=Y-(K=10)+(K=11)'''''''
5Z=SCRN(Q+X,W+Y):IFZ<>20THENX=E:Y=RELSEN=N-1:P=P+1:IFP>19THENP=18:M=N=0ORK=82
6PLOTQ+X,W+Y,P:WAIT9:PLOTQ+X,W+Y,17:UNTILM:IFK<>82THENL=L+1'''''''''''''''''''
7IFL<12THEN2ELSE:PLOT8,5,"Congratulation! You win!":END'''''''''''''''''''''''
8I=L*12+1:N=72:FORY=0TO5:FORX=0TO1:D=ASC(MID$(D$,I,1))-35:FORK=0TO5:C=FNC(2^K)
9IFCTHENC=23:N=N-1ELSEC=20:PLOTQ+X*6+K,Y+W,C:NEXT:I=I+1:NEXTX,Y:A$=KEY$:RETURN

RUN


STORY:

This is a small logic game. The goal is to fill in all the blanks (blue),

and you can't step on already filled spaces (red). The "R" key will restart the level. 

The game has 12 levels.


CODE EXPLANATION:

----------------------------------------

0E$="####6I######'+'#'+#+'+'+##3%##+'S*####))_2_2))####);S&S&);####A)AA/A/)##"

    E$="####6I######'+'#'+#+'+'+##3%##+'S*####))_2_2))####);S&S&);####A)AA/A/)##" - levels data

----------------------------------------

1F$="#$1@##Z^S#)#&#V+#++,#+###'%$=2%4/4####31<13131####)#3\3#_B####+'Q@%3U3##"

    F$="#$1@##Z^S#)#&#V+#++,#+###'%$=2%4/4####31<13131####)#3\3#_B####+'Q@%3U3##" - levels data

----------------------------------------

2PING:LORES0:INK6:Q=14:W=6:D$=E$+F$:?@16,W+7;"Level:"L+1:PLOT15,4,"FillTheBox"

    PING                    - little sound efect of bell

    LORES0                  - set alternative text mode 0 

    INK6                    - set cyan ink

    Q=14                    - playground - x start position

    W=6                     - playground - y start position

    D$=E$+F$                - combines level data into one variable D$

    ?@16,W+7;"Level:"L+1    - print current level

    PLOT15,4,"FillTheBox"   - print game title

----------------------------------------

3POKE#26A,2:DEFFNC(X)=(DANDX)/X:GOSUB8:X=0:Y=5:P=23:REPEAT:PLOT14,W-2,P-16

    POKE#26A,2              - stop system blinking cursor

    DEFFNC(X)=(DANDX)/X     - custom function C(X). return one bit from byte (X = bit number)

    GOSUB8                  - print level subroutine

    X=0                     - start x position

    Y=5                     - start y position

    P=23                    - currnet cursor color

    REPEAT                  - game loop

        PLOT14,W-2,P-16     - print cursor

----------------------------------------       

4K$=KEY$:E=X:R=Y:IFK$>""THENK=ASC(K$):X=X-(K=9)+(K=8):Y=Y-(K=10)+(K=11)

        K$=KEY$                 - get key into K$

        E=X                     - set old X pos into E

        R=Y                     - set old Y pos into E

        IF K$ > "" THEN         - if key pressed

            K=ASC(K$)           - get ascii number

            X=X-(K=9)+(K=8)     - calc now x pos (if pressed left or rifgt arrow key)

            Y=Y-(K=10)+(K=11)   - calc now y pos (if pressed up or down arrow key)

----------------------------------------

5Z=SCRN(Q+X,W+Y):IFZ<>20THENX=E:Y=RELSEN=N-1:P=P+1:IFP>19THENP=18:M=N=0ORK=82

        Z=SCRN(Q+X,W+Y)         - get char into new player position (playground + player)

        IF Z <> 20 THEN         - if screen char is not 20 (blue color)

            X=E                 - x = old x position 

            Y=R                 - x = old x position 

        ELSE

            N=N-1               - reduce the free positions of the playground counter by 1 

        P=P+1                   - increase player cursor color

        IF P > 19 THEN          - if player cursor color is greater then 19 (20 is blue color like playground color)

            P=18                - set player cursoer color on 18 (18 - green color)

            M = N=0 OR K=82     - set M (loop wariable) N == 0 (no more free playground positions), or K == 82 (pressed key 'R')

----------------------------------------

6PLOTQ+X,W+Y,P:WAIT9:PLOTQ+X,W+Y,17:UNTILM:IFK<>82THENL=L+1

        PLOTQ+X,W+Y,P           - print player color cursor

        WAIT9                   - wait 90 ms

        PLOTQ+X,W+Y,17          - print red color cursor

    UNTIL M                     - game loop

    IF K<>82 THEN               - if not pressed 'R' key

        L=L+1                   - incrase level

----------------------------------------

7IFL<12THEN2ELSE:PLOT8,5,"Congratulation! You win!":END

    IF L < 12 THEN              - if not complete all level

        GOTO 2                  - goto line 2

    ELSE

        PLOT8,5,"Congratulation! You win!" - print congratulation message

    END                         - end

----------------------------------------

8I=L*12+1:N=72:FORY=0TO5:FORX=0TO1:D=ASC(MID$(D$,I,1))-35:FORK=0TO5:C=FNC(2^K)

    I=L*12+1                    - set index 

    N=72                        - all free positions in playground

    FORY=0TO5                   - Y loop

        FORX=0TO1               - X bytes loop (the playground data is contained in 2 bytes for line )

            D=ASC(MID$(D$,I,1))-35 - get one byte from string data

            FORK=0TO5           - loop 6 bits

                C=FNC(2^K)      - get currnet bit

----------------------------------------

9IFCTHENC=23:N=N-1ELSEC=20:PLOTQ+X*6+K,Y+W,C:NEXT:I=I+1:NEXTX,Y:A$=KEY$:RETURN

                IF C THEN           - if bit set

                    C=23            - c = 23 (white color)

                    N=N-1           - reduce by one playground free positions counter

                ELSE

                    C=20            - set 20 (blue color)

                PLOTQ+X*6+K,Y+W,C   - print current playground position

            NEXT

            I=I+1                   - increase string data level index  

    NEXTX,Y

    A$=KEY$                         - takes a parasitic key if pressed while drawing a level 

    RETURN                          - return

Install instructions

INSTALLATION INSTRUCTIONS:

1. Download the zip file from here: http://www.petergordon.org.uk/oricutron/files/Oricutron_win32_v12.zip

2. Copy the file FILLTHEBOX.TAP to the Oric\tapes folder

3. Start the emulator oricutron.exe

4. Type CLOAD"FILLTHEBOX.TAP" and press enter

5. LIST to show the program

6. Type RUN to play the game

Keyboard controls: Arrows - move; 'R' - restart Level

Download

Download
FILLTHEBOX.tap 723 bytes
Download
fillthebox.txt 6 kB

Leave a comment

Log in with itch.io to leave a comment.