Standard Chess
A program that reads like the score of a game. The piece is the command and the square is its argument.
MasterWoodie, 2023 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
MasterWoodie made Standard Chess in 2023. Only chess moves in algebraic notation are allowed, and every program has to end in a result, mate or a draw. Underneath is a tape of cells from 0 to 255.
Read the story
The piece that moves picks the command. The square picks what it does, by the file minus the rank, with a to h counted as 1 to 8. A take or a check changes the command, and often makes it read the next move as a number, its square in base 8 from a1 as 0, with 127 added for a take and 64 for a check. So b1+ is 8 plus 64, which is 72, an H.
The machine
| Piece | File minus rank above 0 | Below 0 |
|---|---|---|
| Knight | Subtract | Add |
| Rook | Move the cell pointer left | Right |
| Bishop | Read a character | Write a character |
| King | Jump back when the cell is 0 | Jump forward when the cell is 0 |
The amount is 1, or with a take or a check the next move as a number. The queen works on the difference without its sign. At 3 with a check it sets the cell to the next move, at 2 it turns 0 into 1 and anything else into 0, at 1 it gives the output length, and at 0 a random byte. A pawn does nothing unless it promotes. Castling short starts a loop, castling long jumps back to it, and # or 1/2 ends the game.
Example
The Hello World.
The Hello World. Qa4+ sets the cell to the next move, Ba3 writes it, and the knights add and subtract the rest.
The cat reads with Be1 and writes with Bb5 inside a castled loop. It stops when the input runs out.
A countdown. Bxa3 writes the cell as a number, Nb1 takes 1 off, and once the cell is 0 the king's check jumps 2 moves past the loop to the mate.
Patterns it teaches
- Camouflage: the source is a plausible list of moves.
- Encoding tricks: squares in base 8, with takes and checks as offsets.
Further
See also
Cell-based
Write your own in Run Convert a program from Standard Chess
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: standard-chess.
Command line
shib run standard-chess -e '0-0 Be1 Bb5 0-0-0 #' --input 'hi'shib manual standard-chessSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/standard-chess.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org