Currently I only have tables for the midgame implemented since I don't yet differentiate between game phases.
Code: Select all
king_mid = [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, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, -5, -5, -5, 0, 0,
0, 0, 10, -5, -5, -5, 10, 0]
queen_mid = [-20, -10, -10, -5, -5, -10, -10, -20,
-10, 0, 0, 0, 0, 0, 0, -10,
-10, 0, 5, 5, 5, 5, 0, -10,
-5, 0, 5, 5, 5, 5, 0, -5,
-5, 0, 5, 5, 5, 5, 0, -5,
-10, 5, 5, 5, 5, 5, 0, -10,
-10, 0, 5, 0, 0, 0, 0, -10,
-20, -10, -10, 0, 0, -10, -10, -20]
rook_mid = [10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10,
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, 10, 10, 0, 0, 0,
0, 0, 0, 10, 10, 5, 0, 0]
bishop_mid = [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, 10, 0, 0, 0, 0, 10, 0,
5, 0, 10, 0, 0, 10, 0, 5,
0, 10, 0, 10, 10, 0, 10, 0,
0, 10, 0, 10, 10, 0, 10, 0,
0, 0, -10, 0, 0, -10, 0, 0]
knight_mid = [-5, -5, -5, -5, -5, -5, -5, -5,
-5, 0, 0, 10, 10, 0, 0, -5,
-5, 5, 10, 10, 10, 10, 5, -5,
-5, 5, 10, 15, 15, 10, 5, -5,
-5, 5, 10, 15, 15, 10, 5, -5,
-5, 5, 10, 10, 10, 10, 5, -5,
-5, 0, 0, 5, 5, 0, 0, -5,
-5, -10, -5, -5, -5, -5, -10, -5]
pawn_mid = [ 0, 0, 0, 0, 0, 0, 0, 0,
30, 30, 30, 40, 40, 30, 30, 30,
20, 20, 20, 30, 30, 30, 20, 20,
10, 10, 15, 25, 25, 15, 10, 10,
5, 5, 5, 20, 20, 5, 5, 5,
5, 0, 0, 5, 5, 0, 0, 5,
5, 5, 5, -10, -10, 5, 5, 5,
0, 0, 0, 0, 0, 0, 0, 0]
Code: Select all
piece_value_base_mid_game = [100, 290, 320, 490, 900, 60000, -100, -290, -320, -490, -900, -60000]
I understand that this is super simplified since I am a decent chess player, but it is the best I have for now without complicating the code a million times.
A last reflection is if I should just skip piece square tables and only use basic values and add different positional things such as bonus for castling, advanced pawns, open files, rook on open files and also punishment for e.g. isolated pawns, doubled pawns,restricted mobility. What approach would you go with?
Keep in mind I am writing this in Python and currently a mid game position takes around 5 seconds to reach 4 plies With normal alpha/beta with move ordering but nothing else fancy such as TTs or prunings.