Thursday 25 May 2006

Board Setup and Type Assigment

/** default board setup
*
* 132 [11][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 120 [10][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 108 [9][ ][ ][r][n][b][k][q][b][n][r][ ][ ]
* 96 [8][ ][ ][p][p][p][p][p][p][p][p][ ][ ]
* 84 [7][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 72 [6][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 60 [5][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 48 [4][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 36 [3][ ][ ][p][p][p][p][p][p][p][p][ ][ ]
* 24 [2][ ][ ][r][n][b][k][q][b][n][r][ ][ ]
* 12 [1][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* 0 [0][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
* y,x[0][1][2][3][4][5][6][7][8][9][10][11]
*
*
* */

The above diagram shows how the board is setup.
I have decided to extend the standard 8×8 board dimension to 12×12. The total square would become 144 instead of 64. The game play would not be affected since extended squares are just part of programming side. The main purpose of the extended squares is as an indicator, to indicate that any pieces movement will not hit the borders.. (i.e invalid move indicator).

The overall board setup would be

[x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x]
[x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x]
[x] [x] [r] [n] [b] [k] [q] [b] [n] [r] [x] [x]
[x] [x] [p] [p] [p] [p] [p] [p] [p] [p] [x] [x]
[x] [x] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [x] [x]
[x] [x] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [x] [x]
[x] [x] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [x] [x]
[x] [x] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [x] [x]
[x] [x] [p] [p] [p] [p] [p] [p] [p] [p] [x] [x]
[x] [x] [r] [n] [b] [k] [q] [b] [n] [r] [x] [x]
[x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x]
[x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x] [x]

‘x’ is the extended square. p, n, b, r, k and q are pawn, knight, bishop, rook, king and queen respectively. The squares without label are empty squares. Whenever a move is made, a piece can fill the empty square but not onto the ‘x’ square.

One dimensional (linear) square notatation is used here, counted from bottom to top rows. By looking at the diagram, square 26 is A1 in algebraic notation.

I assign value type to each piece. Type assignment is to replace a long piece name into coded form

king = 10
queen = 8
rook = 5
bishop = 4
knight = 3
pawn = 1

No comments: