JAMGame - Just Another Memory Game

BASIC 10-Liner videogame for the Sinclair ZX81

Marco Varesio (Marco's Retrobits)https://retrobits.itch.io

English language blog: https://retrobits.altervista.org

Italian language blog: https://somebitsofme.altervista.org

Gameplay video:

JAMGame is just another memory videogame, inspired by the well-known Simon electronic game, for the Sinclair ZX81 homecomputer.

JAMGame is my 3rd entry to the 11th edition (2022) of the BASIC 10 Liner Contest: https://basic10liner.com).

Although some memory games have already been submitted to the past editions of the contest, there is no 10-statements version I am aware of, so I coded it ;-)

Game description

JAMGame is a single-player memory game.

A round in the game consists of the computer showing a sequence of pseudorandom numbers in the range between 1 and 4, after which the player must reproduce that order by pressing the corresponding keys, followed by Enter.

As the game progresses, the number of buttons to be pressed increases. The initial length of the sequence is 3.

If the player types the wrong sequence, the game is over and the program must be RUN again for another play.

Two alternating graphics characters help distinguishing the single digits of the sequence to reproduce.

When the sequence presented by the computer is over, the ░ character is displayed near the last digit.

Program description

Variables

`L`: Length of the sequence to reproduce

`A\$`: String containing the sequence to reproduce

`B\$`: Player input; must match the `A\$` string

`I`: Loop iterator

Program listing

The program is 10 lines long and each line is shorter than 80 characters.

The most challenging aspect of the ZX81 BASIC programming is that the interpreter only allows one statement per line.

```

```1 LET L=3
2 LET A\$=""
3 FOR I=1 TO L
4 LET A\$=A\$+STR\$(1+INT(RND*4))
5 PRINT AT 0,0;"LEVEL:";L-2,,A\$(I);" ";CHR\$(9+(I/2=INT(I/2))*(I<L)-1*(I=L))
6 NEXT I
7 INPUT B\$
8 IF B\$<>A\$ THEN STOP
9 LET L=L+1
10 GOTO 2```

```

The following listing can be used with the ZXText2P (http://freestuff.grok.co.uk/zxtext2p/index.html) tool to make a ".P" file suitable for loading into X81 emulators.

Source code explained

Initializations:

Line 1 sets the initial length of the sequence `L` to 3.

Hacking tip: you can change the initial length `L` of the sequence here.

If you do so, you should also change in line 5 the value subtracted from `L`, which determines the current level number, to the initial value of `L` - 1.

Game loop:

Line 2 resets the string containing the sequence to reproduce `A\$` to empty string.

Lines 3 to 6 contain a loop that is executed for `L` times.

In line 4, a random digit between 1 and 4 is randomly chosen and appended to the sequence `A\$`.

Hacking tip**: you can reduce or extend the range of the digits in the sequence by changing the last value (4) in line 4.

Line 5 prints the randomly selected digit.

Next to the digit, 2 graphic characters (half height shaded boxes, with codes 9 and 10) are alternately shown in order to help identifying when a new digit is printed. When the last digit is printed, i.e. when the `I` iterator equals `L`, the full height shaded box character (code: 8) is displayed.

The current level is also printed.

Line 7 prompts for the player's input `B\$`.

Line 8 checks the player input `B\$` against the string to reproduce `A\$`. If they differ, the game is over and the program STOPs (the `9/8` message is displayed on screen). Otherwise, the player successfully reproduced the sequence and program execution continues to line 9.

Line 9 increments the length `L` of the sequence for the next round.

Line 10 jumps back to the beginning of the game loop at line 2.

JAMGame requires a real or emulated ZX81 with at least 4k RAM Pack expansion.

EightyOne emulator

The following instructions apply to the EightyOne (https://sourceforge.net/projects/eightyone-sinclair-emulator/) emulator.

Go to "Options" -> "Hardware..." and make sure that ZX81 with at least a 4k RAM Pack is selected.

Open "Tools" -> "Tape Manager..." and ensure that automatic loading options are selected.

Select “Open Tape…” from the “File” menu to locate and load the **jamgame.p** file.

In the next seconds, if the emulator is configured in order to automatically load tape images, you should see something happening on the screen and finally a white screen with only the `0/0` message on the bottom.

If nothing happens, you must manually start tape image loading, by tapping the J key followed by SHIFT + P twice. You should see the `LOAD ""` message followed by a a black cursor.

To run the program, tap the R key. You should see `RUN` followed by a black cursor on the bottom of the screen. Finally, press ENTER.

Hacking tip: you can change the pseudorandom sequence by issuing a `RAND` command (T key followed by Enter before RUNning the game).

To list the program, tap the K key. You should see `LIST` followed by a black cursor on the bottom of the screen. Finally, press ENTER.

JtyOne Online ZX81 Emulator

 Status Released Author BASIC 10Liner Genre Puzzle Tags 8-Bit, basic, basic10liner, sinclair, zx81

jamgame.bas 216 bytes
jamgame.p 1 kB
jamgame.pdf 91 kB
jamgame.txt 5 kB

## Install instructions

JAMGame requires a real or emulated ZX81 with at least 4k RAM Pack expansion.

EightyOne emulator

The following instructions apply to the EightyOne (https://sourceforge.net/projects/eightyone-sinclair-emulator/) emulator.

Go to "Options" -> "Hardware..." and make sure that ZX81 with at least a 4k RAM Pack is selected.

Open "Tools" -> "Tape Manager..." and ensure that automatic loading options are selected.

Select “Open Tape…” from the “File” menu to locate and load the **jamgame.p** file.

In the next seconds, if the emulator is configured in order to automatically load tape images, you should see something happening on the screen and finally a white screen with only the `0/0` message on the bottom.

If nothing happens, you must manually start tape image loading, by tapping the J key followed by SHIFT + P twice. You should see the `LOAD ""` message followed by a a black cursor.

To run the program, tap the R key. You should see `RUN` followed by a black cursor on the bottom of the screen. Finally, press ENTER.

Hacking tip: you can change the pseudorandom sequence by issuing a `RAND` command (T key followed by Enter before RUNning the game).

To list the program, tap the K key. You should see `LIST` followed by a black cursor on the bottom of the screen. Finally, press ENTER.

JtyOne Online ZX81 Emulator