esolang

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

Expected: Hello World!

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

PieceFile minus rank above 0Below 0
KnightSubtractAdd
RookMove the cell pointer leftRight
BishopRead a characterWrite a character
KingJump back when the cell is 0Jump 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.

Expected: hi

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.

Expected: 321

Patterns it teaches

Further

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-chess

Source

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