10 Line BASIC Challenge

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

Category : PUR-80

TITLE    : Catch The Mouse

PLATFORM : Oric Atmos

AUTHOR   : RAX

LANGUAGE : BASIC 1.1b

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

Story:

You are a professor in a laboratory.

There were earthquakes and all the mice escaped into the maze.

Your goal is to catch them. Be careful that there is electricity on the walls of the maze.

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

```CODE:
1LORES0:C=35:D%=0:FORY=1TO23:X=0:PLOTX,Y,C:X=38:PLOTX,Y,C:NEXT:FORX=1TO37:Y=0'
2PLOTX,Y,C:Y=24:PLOTX,Y,C:NEXT:FORY=2TO22STEP2:FORX=2TO36STEP2:R=INT(RND(1)*4)
3A=0:B=0:IFR=0THENA=-1ELSEIFR=1THENB=-1ELSEIFR=2THENA=1ELSEB=1:PLOTX,Y,C':::::
4PLOTX+A,Y+B,C:NEXTX,Y:X=1:Y=1:L=RND(1)*22+2:J=RND(1)*33+2:E=E+1:?@0,25;"L:"E'
5:REPEAT:K\$=KEY\$:IFK\$THENK=ASC(K\$):X0=X:Y0=Y:Y=Y+(K=11)-(K=10):X=X+(K=8)-(K=9)
6Q=0:W=0:IFD%=1THENQ=-1ELSEIFD%=2THENQ=1ELSEIFD%=3THENW=1ELSEW=-1:DATA12,,30':
7IFSCRN(J+Q,L+W)<34THENPLOTJ,L,16:J=J+Q:L=L+W:PLOTJ,L,34ELSED%=RND(1)*5'::::::
8POKE#B51A,FNR(0):POKE#B51C,FNR(0):DATA45,,12,18,51,,6,17,47,63,18,,':::::::::
9O=SCRN(X,Y):PLOTX0,Y0,16:PLOTX,Y,33:UNTILO>33:SHOOT:IFO=34THEN1ELSEZAP:CLS'::
RUN ```

DEFFNR(X)=RND(1)*63AND28 - defining a function that returns a random value for the wall sprite

E=0 - level

POKE#26A,10             - hide command prompt and disable keyboard sound

===========

1LORES0:C=35:D%=0:FORY=1TO23:X=0:PLOTX,Y,C:X=38:PLOTX,Y,C:NEXT:FORX=1TO37:Y=0'

LORES0

C=35                    - wall char (sprite)

D%=0                    - mouse direction

FORY=1TO23              - print vartical border

X=0

PLOTX,Y,C

X=38

PLOTX,Y,C

NEXT

FORX=1TO37              - print horisontal border

Y=0

===========

2PLOTX,Y,C:Y=24:PLOTX,Y,C:NEXT:FORY=2TO22STEP2:FORX=2TO36STEP2:R=INT(RND(1)*4)

PLOTX,Y,C           - print horisontal border

Y=24

PLOTX,Y,C

NEXT

FORY=2TO22STEP2         - print labirynth; vertical iteration

FORX=2TO36STEP2     - horizontal iteration

R=INT(RND(1)*4) - get random orientation

===========

3A=0:B=0:IFR=0THENA=-1ELSEIFR=1THENB=-1ELSEIFR=2THENA=1ELSEB=1:PLOTX,Y,C'

A=0             - random wall position X

B=0             - random wall position Y

IF R=0 THEN     - if R = 0 then direction "left"

A=-1

ELSE

IF R=1 THEN - if R = 1 then direction "up"

B=-1

ELSE IF R=2 THEN if R = 2 then direction "right"

A=1

ELSE        - direction "down"

B=1

PLOTX,Y,C       - print 1st wall

===========

4PLOTX+A,Y+B,C:NEXTX,Y:X=1:Y=1:L=RND(1)*22+2:J=RND(1)*33+2:E=E+1:?@0,25;"L:"E

PLOTX+A,Y+B,C   - print 2nd wall

NEXTX,Y                 - NEXT

X=1                     - player x pos

Y=1                     - player y pos

L=RND(1)*22+2           - mouse y pos

J=RND(1)*33+2           - mouse y pos

E=E+1                   - level

?@0,25;"L:"E            - print level

===========

5REPEAT:K\$=KEY\$:IFK\$THENK=ASC(K\$):X0=X:Y0=Y:Y=Y+(K=11)-(K=10):X=X+(K=8)-(K=9)

REPEAT                  - start iteration

K\$=KEY\$                 - get key

IF K\$ THEN              - if key pressed

K=ASC(K\$)           - get ascii code of key

X0=X                - get olx X pos

Y0=Y                - get olx Y pos

Y=Y+(K=11)-(K=10)   - new Y pos if pressed "up" or "down" key

X=X+(K=8)-(K=9)     - new X pos if pressed "left" or "right" key

===========

6Q=0:W=0:IFD%=1THENQ=-1ELSEIFD%=2THENQ=1ELSEIFD%=3THENW=1ELSEW=-1:DATA12,,30

Q=0                     - X offset

W=0                     - Y offset

IFD%=1THEN              - direction left

Q=-1                - x offset =-1

ELSE

IF D%=2 THEN        - direction right

Q=1             - x offset = 1

ELSE

IFD%=3 THEN     - direction down

W=1         - y offset = 1

ELSE            - direction up

W=-1            - y offset = -1

DATA12,,30              - character definition data

===========

7IFSCRN(J+Q,L+W)<34THENPLOTJ,L,16:J=J+Q:L=L+W:PLOTJ,L,34ELSED%=RND(1)*5

IF SCRN(J+Q,L+W)<34 THEN - if new mouse pos is free

PLOTJ,L,16          - delete old mouse

J=J+Q               - calc new mouse X pos

L=L+W               - calc new mouse Y pos

PLOTJ,L,34          - print mounse in new pos

ELSE

D%=RND(1)*5         - get new random direction for mause

===========

8POKE#B51A,FNR(0):POKE#B51C,FNR(0):DATA45,,12,18,51,,6,17,47,63,18,,

POKE#B51A,FNR(0)        - define new wandom wall line of sprite

POKE#B51C,FNR(0)        - define new wandom wall line of sprite

DATA45,,12,18,51,,6,17,47,63,18,, - character definition data

===========

9O=SCRN(X,Y):PLOTX0,Y0,16:PLOTX,Y,33:UNTILO>33:SHOOT:IFO=34THEN1ELSEZAP:CLS

O=SCRN(X,Y)             -scan new player pos on the screen in pos X,Y

PLOTX0,Y0,16            - delete player feom old pos

PLOTX,Y,33              - print player in new pos

UNTILO>33               - until player hits something

SHOOT                   - shot from a rifle sfx

IF O=34 THEN 1          - if plaget catch the mouse then goto 1

ELSE

ZAP                 - laser sfx

CLS                 - clear screen

 Status Released Author BASIC 10Liner Genre Action Tags 8-Bit, basic, basic10liner, oric-atmos

## Install instructions

INSTALLATION INSTRUCTIONS

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

3. Start the emulator oricutron.exe

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

5. LIST to show the program

6. Type RUN to play the game

Keyboard controls: Arrows