Chess

From Esolang
Jump to navigation Jump to search

Chess is an incomplete programming language idea created by User:Smallhacker.

Chess is a programming language where the code is a game of chess. One has to be a chess expert to code anything in this language. Two possible ways to make this:

  • The board is analyzed after the game is finished, translating it into 2D code, possibly something like SNUSP, then executed.
  • Each move corresponds to a command. Depending on the type of move, different things happens. Perhaps the destination row of the piece being moved could be translated into a brainfuck instruction, or maybe which kind of piece being moved decides?
Anything but brainfuck encoding, please. Brainfuck is my favourite language but I don't like seeing other languages using its instruction set -- and I'm certainly not alone with this opinion. There are many possibilities for this kind of language, no need to use the brainfuck set, unless you especially want to. --Keymaker 06:16, 8 October 2007 (UTC)
There is another program language based on chess, that I invented, it is called InfChessPro. --Zzo38 13:58, 8 October 2007 (UTC)

How about:

Pieces:
	Pawn: (no symbol) 
	Bishop: B
	Knight: N
	Rook: R
	Queen: Q
	King: K

Act as variables that add values based on the squares they are moved to and all initialize at
zero.  The king is special and is used for memory purposes (see below) and its moves are arbitrary
if they even exist (they do not alter the value).

Files:
	a, b, c, d, e, f, g, and h

See below.

Ranks:
	1, 2, 3, 4, 5, 6, 7, and 8

Act with files as an octal number that adds as a value in the piece variables:

a1: 00
a2: 01
…
h7: 76
h8: 77

Capture:
	x

Used to reset “captured” piece’s value and add to “capturing” piece’s value.  The space on which 
the capture takes place is also still added to the capturing piece's value.

Pawn Promotion:
	=

Used to reset the pawn’s value and copy the value of the piece it is promoted to into the pawn’s
value.

Castling:
	Kingside: 0-0 or O-O
	Queenside: 0-0-0 or O-O-O

0-0 resets the memory (king’s value).
0-0-0 prints the memory as an ASCII character.

Check and Checkmate:
	Check: +
	Double-check: ++
	Checkmate: #

Check copies the value of the referenced piece to the memory (king’s value).  Double-check copies
the value of the memory (king) to the referenced piece.  Checkmate ends the program.

Move Numbers:
	1. white black
	2. white black
	3.white
	“comment”
	3. … black
 
Used to format instructions into pairs like chess notation.  Comments can be used as in chess
notation.

Punctuation:
	!: good move
	!!: excellent move
	?: bad move
	??: blunder
	!?: interesting move
	?!: dubious move

! prints the referenced piece’s value mod 128 as an ASCII character.
!! asks for an input and copies the octary value to the memory (king).
? resets the referenced piece’s value to zero.
?? asks for an input and adds the octary value to the memory (king).
!? begins a while loop starting on the next instruction that runs as long as the memory is non-zero.
?! ends the while loop and initiates a memory recheck for non-zero memory.

PuzzleHunter84 15:16, 17 August 2009 (UTC)

Fool's mate:

1. f3? e5 2. g4?? Qh4!#

prints a ;.

Scholar's mate:

1.e4 e5 2.Qh5!? Nc6?! 3.Bc4 Nf6?? 4.Qxf7!#

prints a 1.