-
Couldn't load subscription status.
- Fork 0
Home
Welcome to the JavaChessEngine wiki!
This project was my attempt at building a chess engine from scratch, and it is definitely not the most efficient. At its current state, it can analyse about 4,000 positions a second. At depth 4, it takes about 3-5 minutes to analyse around 2 million positions.
The board is represented in a Game class that stores the board as Piece[][]. It stores other information about the game such as En Passant, Castling Rights and Move Clocks. Having a 2D Piece array as the board adds overhead for accessing, but it allowed me an easier representation for calculating positions. The following breakdown how the array matches up with a typical chess board, where the rank numbers was aligned to the array indices.
Typical Chess Board
* Black
[A8][B8][C8][D8][E8][F8][G8][H8]
[A7][B7][C7][D7][E7][F7][G7][H7]
[A6][B6][C6][D6][E6][F6][G6][H6]
[A5][B5][C5][D5][E5][F5][G5][H5]
[A4][B4][C4][D4][E4][F4][G4][H4]
[A3][B3][C3][D3][E3][F3][G3][H3]
[A2][B2][C2][D2][E2][F2][G2][H2]
[A1][B1][C1][D1][E1][F1][G1][H1]
* White
*
ARRAY REFERENCE TABLE
* WHITE
[A1][B1][C1][D1][E1][F1][G1][H1]
[A2][B2][C2][D2][E2][F2][G2][H2]
[A3][B3][C3][D3][E3][F3][G3][H3]
[A4][B4][C4][D4][E4][F4][G4][H4]
[A5][B5][C5][D5][E5][F5][G5][H5]
[A6][B6][C6][D6][E6][F6][G6][H6]
[A7][B7][C7][D7][E7][F7][G7][H7]
[A8][B8][C8][D8][E8][F8][G8][H8]
* BLACK
*
WHITE
[0,0][1,0][2,0][3,0][4,0][5,0][6,0][7,0]
[0,1][1,1][2,1][3,1][4,1][5,1][6,1][7,1]
[0,2][1,2][2,2][3,2][4,2][5,2][6,2][7,2]
[0,3][1,3][2,3][3,3][4,3][5,3][6,3][7,3]
[0,4][1,4][2,4][3,4][4,4][5,4][6,4][7,4]
[0,5][1,5][2,5][3,5][4,5][5,5][6,5][7,5]
[0,6][1,6][2,6][3,6][4,6][5,6][6,6][7,6]
[0,7][1,7][2,7][3,7][4,7][5,7][6,7][7,7]
BLACK
A File = [0,y] B File = [1,y]
C File = [2,y] D File = [3,y]
E File = [4,y] F File = [5,y]
G File = [6,y] H File = [7,y]
1st Rank = [x,0] 2nd Rank = [x,1]
3rd Rank = [x,2] 4th Rank = [x,3]
5th Rank = [x,4] 6th Rank = [x,5]
7th Rank = [x,6] 8th Rank = [x,7]