InfChessPro

From Esolang
Jump to: navigation, search

You have a infinite chess board that starts blank. Make a file with lines numbered like this and execute from top to end:

1. 3,1,5,0
2. nothing=K6,0
3. nothing;1,1!1

Notes:

  • abs1 and abs2 are absolute positions, as in row,col where row and col are numbers. White pawns (uppercase) go forward increasing row number, black pawns (lowercase) go backward decreasing row number.
  • rel1 and rel2 are relative positions, as in row,col where row and col are numbers relative to the position that the piece is moving from.

These are the commands:

  • abs1,abs2 = moves a piece from abs1 to abs2 if it can move like that in the normal rules of chess. There is no castling, enpassant, promotion, and a piece can move as far as it wants. You are not allowed to move a piece of your own color if doing so would put any king(s) of your color in check or keep any king(s) of your color in check.
  • name=typeabs1 = adds a piece to space abs1 if that space is vacant (you can even place kings where it would be in check or place pieces if it would not get you out of check). The name can be any name with letters, numbers, underscores, and it doesn't have to be unique you can have multiple pieces with the same name (even if they are different color or type). The type is a letter indicating the type of chess piece, uppercase for white or lowercase for black.
  • name,abs1 = moves a piece called name to abs1 position (using same moving rules as above). If multiple pieces with the same name, tries the newest one first, if that one isn't successful it tries the next newest one, and so on.
  • name;rel1 = same as above but relative movement instead.
  • ^ = always successful but has no effect.
  • "text = output text.
  • %name = output the number of pieces with that name.

After each command you can optionally put ? or ! followed by a line number. If ? and command is successful, it goto line number. If ! and command is not successful, then it goto line number. You can put * anywhere to input a number.

You can have comments with # at front of line, with no numbers.

Proof of turing complete

This is (I think) proof of turing complete. You can make a register machine with any number of registers. Each one is a named rook. For example:

1. x=R0,*
2. y=R1,*
3. z=R2,*

and you need something to stop it from moving too far backward (such as pawns), for example:

4. stop=P0,-1
5. stop=P1,-1
6. stop=P2,-1

It is possible to do increment, decrement, and jumps and stuff:

7. z;0,-1?7
8. x;0,-1!11
9. y;0,1
10. z;0,1?8
11. "stop

Examples

Beer program:

1. Amount=K99,0
2. Beer=P0,0!4
3. Beer;1,0?3!2
4. Drunk=k-1,0
5. %Beer
6. "bottles of beer on the wall.
7. %Beer
8. "bottles of beer.
9. "Take one down, and pass it around.
10. Drunk;1,0!14
11. %Beer
12. "bottles of beer on the wall.
13. ^?5
14. "No more bottles of beer on the wall.