Chess

ReleasedVersion 1.0

A chess engine in 6303 machine code for the four-line Organisers, eight levels from about 450 to 1950 Elo.

Four-line screen: White's half of the board as letters on the left, with rank numbers, the last move dxc4, and a map of the whole board in custom characters on the right
Board, White's half
Four-line screen: Black's half of the board, ranks 8 to 5, after pressing MODE
Board, Black's half (MODE)
Four-line screen: the bottom line reads HINT E1G1, suggesting castling
Hint

Download

Build: pack image

File
chess-1.0.opk
Version
1.0
Size
61,274 bytes
Date
SHA-256
b2a9150710bfd02d590938565f10b8cb0d52096c3fc4e88077e133560103b61d

Download the build

Source + build (zip)

File
chess-1.0-source.zip
Version
1.0
Size
5,067,464 bytes
Date
SHA-256
721b9895ec78ce666600c03f4d021cd78149762d7e8520622b2e075821dba961

Download source + build

The pack image is a 256K Flashpak image with about 60K used. In an emulator, load it into slot B of an LZ or LZ64. On a real Organiser, load the psion/ folder from the source + build zip with RPBOOT onto a Rampak or Flashpak of 64K or more in B: or C:.

Licence: MIT.

Compatibility

ModelRuns it?Note
CMNot supportedNeeds the four-line screen and more RAM
XPNot supportedNeeds the four-line screen and more RAM
LANot supportedNeeds the four-line screen
LZWorksSmaller transposition table (needs 16,923 bytes free)
LZ64WorksFull 512-entry table (needs 19,611 bytes free)

Tested on the Jape emulator (LZ64), with speed checks on a real Organiser that matched the emulator.

About

A full chess game for the LZ and LZ64. The engine is written in 6303 assembler and matched node for node against a JavaScript reference engine, so every change could be measured before it went onto the Organiser. Eight levels, measured against Stockfish's limited-strength scale, run from about 450 to about 1950; level 7, at 30 seconds a move, plays at about 1700.

It has a position book of 4,887 positions that recognises transpositions, and plays king and pawn against king perfectly from a compressed distance table on the pack. The game has clocks, take back, hints, a move list, game review with analysis, set-up, a real-board mode, two-player mode, and PGN export and import.

The game picks the largest transposition table the free RAM allows, so it runs on a 32K LZ with a smaller table and on an LZ64 with the full one.

Install

  1. Download the pack image, chess-1.0.opk.
  2. In the Jape emulator, choose LZ64 (or LZ), load the file into slot B.
  3. On the Organiser: Prog, Run, then type B:CHESS and press EXE.
  4. For a real Organiser, see Getting started for loading with RPBOOT.

If there is too little RAM, CHESS says how many bytes are missing.

Manual

Key Action
A–H then 1–8 Type a move, such as E2E4. No SHIFT: the keys U V W O P Q I J are 1 to 8. Castle by moving the king (E1G1)
Arrows, EXE Point: the arrows move a cursor, EXE picks the piece up, then the arrows step through its legal squares and EXE puts it down
DEL Rub out a typed square; with nothing typed, take back your move and the reply
MODE Show the other half of the board
SPACE Hint: a 2-second look
ON/CLEAR Clear what you typed, or open the menu

While it thinks, any key makes it move now. The menu has new game, level, take back, hint, flip, move list, game review, export PGN, import game, set up, settings, offer a draw, resign, and save and leave. The game is saved after every move and resumes where it was.

Levels: 1 to 8, or Auto. They take 1, 1, 2, 3, 3, 10, 30 and 255 seconds a move and measure at about 450, 650, 950, 1200, 1450, 1550, 1700 and 1950.

Game review (G in the menu): RIGHT or EXE for the next move, LEFT or DEL for the one before, DOWN and UP for ten plies, SPACE to analyse, P to play on from that position.

Technical notes

  • The engine searches about 70 to 120 positions a second on the Organiser.
  • The game uses a RAM array of 19,030 bytes with a 512-entry transposition table on the LZ64.
  • The program takes about 60K of its 256K pack budget.
  • Bishop and knight mates succeed in about 80% of random starts.

Changelog

DateVersionChange
1.0First release.

Source

The source is in the source + build zip, under the MIT licence. It holds the program as committed, the shared Psion tools it builds with, and the built pack, and it rebuilds the same pack byte for byte. A public repository will follow.