.CHE$$

From Esolang
Jump to navigation Jump to search

.Che$$ (pronounced "dot chess") is an unfinished programming language idea by Elliptical. It is supposed to (somewhat) replicate a chess game.

Setup

You begin with an 8x8 array of values, in the form of a chessboard. Each piece is marked by a certain letter. (Lowercase = Black) (Uppercase = White)

P = PAWN

R = ROOK

K = KNIGHT

B = BISHOP

Q = QUEEN

x1 = notation for WHITE KING

x2 = notation for BLACK KING

# = notation for BLANK SQUARE

 r k b q x2 b k r
 p p p p p p p p
 # # # # # # # #
 # # # # # # # #
 # # # # # # # #
 # # # # # # # #
 P P P P P P P P
 R K B Q x1 B K R

Addresses

Each square also has an address, as used in normal chess.

Caption text
a b c d e f g h
8 a8 b8 c8 d8 e8 f8 g8 h8
7 a7 b7 c7 d7 e7 f7 g7 h7
6 a6 b6 c6 d6 e6 f6 g6 h6
5 a5 b5 c5 d5 e5 f5 g5 h5
4 a4 b4 c4 d4 e4 f4 g4 h4
3 a3 b3 c3 d3 e3 f3 g3 h3
2 a2 b2 c2 d2 e2 f2 g2 h2
1 a1 b1 c1 d1 e1 f1 g1 h1

Initiation functions

.Che$$ contains many built in functions that set the board to a well known state. Each line starts with |.

|start_white - A normal starting chessboard, with white on the bottom.

|start_black - A normal starting chessboard, with black on the bottom.

Commands

Set Commands

Set a square to a given piece

Start the line with @.

@

Next, name a piece.

@P

Finally, name a square address.

@Pa1

This will set square a1 to a White Pawn.

Copy a piece from one square to another

Start the line with +.

+

Next, name a square address.

+a1

Finally, name another square address.

+a1b2

This reads the piece of square a1, and places it on the square b2.

Move a piece

By combining the commands already given, we can move a piece as normally done in chess.

+a1b2
@a1#

This will set square b2 to whatever is on square a1, then set square a1 to # (BLANK SQUARE).

Read Commands

Read commands accept a square address and a piece of data.

Begin the line with &

&

Next, add a square address.

&a1

Finally, add text to the end.

&a1Hello World!

Depending what the piece on the square is, different things will happen to the text.

Blank Square

If the given square contains nothing, then the line returns nothing.

Pawn

White

If the given square contains a white pawn, then it will print the text to the console.

&a1Hello World!
Hello World!

Black

If the given square contains a black pawn, then it will treat the text as a set command (@).

&a1Pb2
Will set square b2 to a White Pawn

Bishop

White

This will take the text and use it as a prompt for an input. This input is read as a set command(@).

&a1Enter a set command: 
Enter a set command:
Enter a set command:b2P ¶
This will set square b2 to a White Pawn