Skip to content

[T1] Board representation

cybergaukler edited this page Jan 20, 2025 · 8 revisions

To represent the board and movement options a layout array with different layers is created. Each layer is based on the initial board and has the same shape of that board but different content

Shape of the board

For a regular chess board there are 8 rows, each with 8 tiles represented by an 8x8 array i.e. the initial board layout where only a middle strip of 2x4 tiles is playable:

[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,1,1,0,0,0],
[0,0,0,1,1,0,0,0],
[0,0,0,1,1,0,0,0],
[0,0,0,1,1,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0]

Movement options

The movement options are a multi dimensional array per piece with layer 0 depicting the current positioning and each layer after the state of the game as if the piece moved. Unlike the initial board layout here each tile is an array with information like role, health and armor of the piece occupying the tile.

The tile array:

Currently the tile array has 3 bits of data: the piece, the pieces attack, health and the pieces armor. I.e. [-1, 2, 2, 0] for the black shah with 2 attack, 2 health and 0 armor

Element 1: color and role of pieces

The first element is representing the color and role of the pieces occupying the tile. The roles are encoded as follows: shah:1, vizier:2, rukh:3, alfil:4, asb:5, piyadeh:6 By multiplying the encoding with -1 the color is set with black pieces having negative numbers and white positive. i.e. a black vizier would be encoded -2 while a white piyadeh is 6

Element 2, 3 and 4: Attack, Health and armor of the pieces

Here the actual values are noted. A black rukh with 2 attack, 3 heath and 1 armor would note as [-3,2,3,1]

optional Element 4: Conflict

To indicate that there was an attack on the tile a 4th element is used to either depict that an attack killed of an enemy piece at that position or that the moving piece was repelled from the tile.

Obliterating attack

If the attack completely removed the enemy piece from the board the position will display the information of the attacking piece (as the piece has won the tile) with an additional information which enemy piece lost. I.e. a black rukh with 2 attack, 3 health and 1 armor won the fight against a white piyadeh the information would be [-3, 2, 3, 1, 6] indicating the white piyadeh (encoded 6) lost the tile

Attack is repelled

If a piece cant capture a tile it usually is repelled in the direction it has attacked from. In that case the additional information shows which piece attacked. I.e. a black rukh attacked a piyadeh with 2 attack who still had 1 health and 0 armor after the attack thereby repelling the rukh. The tile would still be occupied by the piyadeh and would get the additional information that the black rukh was repelled leading to a notation of [6, 2, 1, 0, -3]

(Temporary) effects from maneuvers

Some maneuvers have temporary effects on the attributes of the pieces. I.e. the maneuver “close ranks” adds one armor to the piece executing the maneuver and all friendly pieces left and right of that piece for the duration of the next enemy turn. For this another layer is created for the movement storing that information in pairs of [effect, duration] in an array with [attack, heath, armor]. The duration is measured in turns.

Todo: effects with triggers instead if turns Effects that weaken/strengthen per turn

[0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,2,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0]'