# Quirkafleeg for the Commodore 64 / 128 – beta

A chess program for an unexpanded C64 (or a C128 in C64 mode). One file, `quirkafleeg.prg` (47 KB), also on the disk
image `quirkafleeg.d64`.

## Loading

    LOAD"QUIRKAFLEEG",8
    RUN

`LOAD"*",8,1` works as well. From a standard 1541 the load takes about two minutes; a fast loader (JiffyDOS, Action
Replay, Epyx FastLoad, SD2IEC with a fast loader) makes it a matter of seconds.

## Playing

You play White, the computer Black. Type the move as from- and to-square, then RETURN:

    e2e4 RETURN

Typing a square with one of your pieces selects it, so `e2 RETURN e4 RETURN` works as well, and typing another of your
pieces changes your mind. Letters a–h and digits 1–8 move the cursor; the cursor keys and a joystick in port 2 work too
(RETURN or fire selects the piece under the cursor, then the square to move to). An illegal move is simply not played.
When a pawn reaches the last rank, the program asks `Q R B N ?`: press the letter (RETURN = queen).

The computer thinks on your time (pondering): if you play the move it expects, it answers sooner.

While the computer thinks, the two lines under the status bar show its search as it goes, in white: after each
finished search depth the score so far and the best move so far, e.g. `White +0.35` / `Depth 5 Nf3`. (When it
thinks on your time and you play the move it expects, the lines pick up at the next finished depth.)

After each of its moves the panel shows how the computer sees the position, in pawns: `Equal` (within 0.3),
`White +0.65` or `Black +1.20` (that side is ahead by so much), or `White mates` / `Black mates`; and the reply it
expects from you, e.g. `Expects Bb5`. The move list and the hint use standard algebraic notation (Nf3, exd5, O-O,
e8=Q, Nbd7, Qxf7+, Qxf7#).

## Keys

| Key | |
|---|---|
| F1 | the computer plays the side to move (also: switch sides, or let it play on after back / forward) |
| F2 (Shift+F1) | opening book on / off |
| F3 | turn the board |
| F4 (Shift+F3) | C128 only: speed 1.4x → 1 MHz → 2 MHz (see below) |
| F5 | level (before the first move) |
| F7 | new game |
| ? (or /) | hint: the move the computer expects from you; RETURN plays it |
| − / + | one move back / forward. After going back the computer waits: play on yourself, or press F1 |
| s | set up a position (below) |

Levels: 5, 15 or 60 s per move (an average: a single move may take up to twice that), 5 min game, 15 min + 10 s per move,
60 min game, 40 moves in 120 min, depth 4.

### Setting up a position (s)

Move the cursor with the cursor keys, the joystick or the digits; `p n b r q k` put a white piece, the same key again
makes it black (and again white); `x` or DEL empties the square, `c` clears the board, `+` changes the side to move,
RETURN starts. (Use the cursor keys for the b- and c-files: in set-up mode `b` is a bishop and `c` clears the board.)
After set-up the computer waits for F1, so you can also enter moves for both sides.

## End of the game

Checkmate, stalemate, the computer running out of time, and draws by threefold repetition, the 50-move rule and lack of mating material
(no pawns, rooks or queens and at most one knight or bishop) end the game. The game record holds 255 half-moves;
a game that reaches that length is declared drawn (shown as `Draw: 50 mv.`). F7 starts a new one.

Your own clock never ends the game: at 0:00 it stays there and you play on. So you can relay moves by hand between
Quirkafleeg and another computer at any level; the computer's clock runs only while Quirkafleeg itself thinks.

## C128

On a C128 (in C64 mode) the program uses the 2 MHz mode. The line under the title shows the speed; F4 changes it:

- **1.4x** (default): 2 MHz while the screen is in the border, the board stays visible.
- **1 MHz**: as a C64.
- **2 MHz**: the screen is off while the computer thinks (the border turns blue; so no live lines); strongest.

## Strength

Measured in emulation with 40 s + 11 s per move, against Colossus Chess 4.0 (C64), 200 games each:
C64 65.8 % (about +110 Elo), C128 1.4x 68 %, C128 2 MHz 81 %.

## Known limitations of the beta

- Tested in emulators (our own c64run and VICE x64sc), not yet on real hardware; the C128 modes only in our emulator.
- A game ends as a draw after 255 half-moves (the size of the game record).
- A draw by repetition is noticed when it is your turn (a repetition created by your own move is noticed one move later).
- With a single legal move the computer still thinks for its normal time.

## Reporting bugs

Please note the level, the moves (the move list, or a photo of the screen) and what happened.
