4DChess

From Esolang
Jump to navigation Jump to search

4DChess is an esoteric programming language designed by User: Zemeckis on 18th November, 2019. It is directly inspired from Brainfuck. Instead of brainfuck's usual one-dimensional memory cell array, 4DChess uses a four-dimensional hypercube-like memory cell array of 8 cells per dimension.

Overview

Unlike most brainfuck derivatives, the memory cell array is intentionally, and specifically, limited in length. Each dimension is limited to 8 cells per the particular dimension. This 8 cell per dimension array is what inspires the name, being reminiscent of a chess board, but in four dimensions. However, the pointer can be freely moved in all 4 dimensions, or axis. referred to as the X axis, the Y axis, the Z axis, and the W axis. This multi-dimensional memory cell array has inspired referring to the memory space as a hypercube, a 4-dimensional cube. The pointer starts at 0, 0, 0, and 0, on the X, Y, Z, and W axis respectively. This means that the pointer starts in a corner of the hypercube.

Limitations

The limitations of 4DChess give the user a memory space of 4,096 bytes. (8^4) This specifically limited memory space means that 4DChess is not Turing-complete. 4DChess also does not allow array overflows or underflows. Attempting to move the pointer to an array position below 0(1) and above 7(8) on any array axis results in an error. This is referred to "Falling off the hypercube," in whichever particular axis and direction the error occurred. This means that 4DChess programs are very strictly confined to the boundaries of the hypercube.

Commands

4DChess's commands are similar to brainfuck's, but has included 3 new pairs of pointer controllers, two for the Y axis, two for the Z axis, and two for the W axis.

Command Description
> Increase the pointer's position along the X axis
< Decrease the pointer's position along the X axis
^ Increase the pointer's position along the Y axis
v Decrease the pointer's position along the Y axis
* Increase the pointer's position along the Z axis
o Decrease the pointer's position along the Z axis
@ Increase the pointer's position along the W axis
? Decrease the pointer's position along the W axis
+ Increment the memory cell under the pointer
- Decrement the memory cell under the pointer
. Output the character signified by the cell at the pointer's position on the X, Y, Z, and W axis
, Input a character and store it in the cell at the pointer's position on the X, Y, Z, and W axis
[ Jump past the matching ] if the cell under the pointer is 0
] Jump back to the matching [ if the cell under the pointer is nonzero

Purpose

4DChess was created with the purpose of forcing the user to work within a strict memory array, and with a secondary goal of making sure most normal brainfuck programs will not directly translate.