mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00

This time with a new algorithm by Joona. It works basically like this: repeat { 1) pick 8000 random positions from qsearch 2) "go depth 8" to get the true evaluation. 3) "eval" to get the stand pat score 4) Adjusting parameters one by one to minimize deltasum between true evaluation and stand pat scores. } * Good news: method seems to converge * Bad news: Point where it converges is not optimum. So it's more or less trial and error... sometimes works, sometimes doesn't. It can give you the right direction, but if you let it run too long, it fails. Far from scientific ;) After 14800 games with 5s/game Orig - Mod: 3318 - 3570 - 7626 (+6 elo) Signed-off-by: Marco Costalba <mcostalba@gmail.com>
163 lines
6.1 KiB
C
163 lines
6.1 KiB
C
/*
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
|
|
Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
|
|
|
|
Stockfish is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Stockfish is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
#if !defined(PSQTAB_H_INCLUDED)
|
|
#define PSQTAB_H_INCLUDED
|
|
|
|
////
|
|
//// Includes
|
|
////
|
|
|
|
#include "value.h"
|
|
|
|
|
|
////
|
|
//// Values tuned by Joona Kiiski
|
|
////
|
|
|
|
static const int MgPST[][64] = { // [piece][square]
|
|
{},
|
|
{ // Pawn
|
|
4, 5, 7, 8, 8, 7, 5, 4,
|
|
162, 183, 194, 204, 204, 194, 183, 162,
|
|
164, 185, 201, 227, 227, 201, 185, 164,
|
|
165, 186, 210, 247, 247, 210, 186, 165,
|
|
166, 187, 211, 229, 229, 211, 187, 166,
|
|
167, 188, 204, 209, 209, 204, 188, 167,
|
|
168, 189, 200, 210, 210, 200, 189, 168,
|
|
8, 9, 11, 12, 12, 11, 9, 8
|
|
},
|
|
{ // Knight
|
|
675, 709, 742, 759, 759, 742, 709, 675,
|
|
721, 752, 785, 802, 802, 785, 752, 721,
|
|
765, 797, 827, 841, 841, 827, 797, 765,
|
|
794, 823, 853, 869, 869, 853, 823, 794,
|
|
808, 834, 865, 881, 881, 865, 834, 808,
|
|
807, 833, 864, 879, 879, 864, 833, 807,
|
|
764, 794, 823, 837, 837, 823, 794, 764,
|
|
624, 752, 783, 799, 799, 783, 752, 624
|
|
},
|
|
{ // Bishop
|
|
795, 792, 796, 800, 800, 796, 792, 795,
|
|
824, 845, 841, 844, 844, 841, 845, 824,
|
|
830, 841, 855, 848, 848, 855, 841, 830,
|
|
835, 844, 848, 867, 867, 848, 844, 835,
|
|
834, 843, 847, 866, 866, 847, 843, 834,
|
|
827, 838, 852, 845, 845, 852, 838, 827,
|
|
821, 841, 837, 840, 840, 837, 841, 821,
|
|
821, 820, 824, 830, 830, 824, 820, 821
|
|
},
|
|
{ // Rook
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258,
|
|
1258, 1263, 1268, 1272, 1272, 1268, 1263, 1258
|
|
},
|
|
{ // Queen
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529,
|
|
2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529
|
|
},
|
|
{ // King
|
|
287, 311, 262, 214, 214, 262, 311, 287,
|
|
262, 287, 238, 190, 190, 238, 287, 262,
|
|
214, 238, 190, 142, 142, 190, 238, 214,
|
|
190, 214, 167, 119, 119, 167, 214, 190,
|
|
167, 190, 142, 94, 94, 142, 190, 167,
|
|
142, 167, 119, 69, 69, 119, 167, 142,
|
|
119, 142, 94, 46, 46, 94, 142, 119,
|
|
94, 119, 69, 21, 21, 69, 119, 94
|
|
}
|
|
};
|
|
|
|
static const int EgPST[][64] = { // [piece][square]
|
|
{},
|
|
{ // Pawn
|
|
2, 0, -2, -4, -4, -2, 0, 2,
|
|
253, 251, 249, 247, 247, 249, 251, 253,
|
|
253, 251, 249, 247, 247, 249, 251, 253,
|
|
253, 251, 249, 247, 247, 249, 251, 253,
|
|
254, 252, 250, 248, 248, 250, 252, 254,
|
|
254, 252, 250, 248, 248, 250, 252, 254,
|
|
254, 252, 250, 248, 248, 250, 252, 254,
|
|
4, 2, 0, -2, -2, 0, 2, 4
|
|
},
|
|
{ // Knight
|
|
741, 765, 791, 806, 806, 791, 765, 741,
|
|
766, 790, 818, 834, 834, 818, 790, 766,
|
|
790, 816, 844, 858, 858, 844, 816, 790,
|
|
803, 830, 855, 873, 873, 855, 830, 803,
|
|
803, 830, 855, 873, 873, 855, 830, 803,
|
|
790, 816, 844, 858, 858, 844, 816, 790,
|
|
766, 790, 818, 834, 834, 818, 790, 766,
|
|
741, 765, 791, 806, 806, 791, 765, 741
|
|
},
|
|
{ // Bishop
|
|
798, 816, 826, 836, 836, 826, 816, 798,
|
|
814, 831, 841, 849, 849, 841, 831, 814,
|
|
820, 838, 847, 856, 856, 847, 838, 820,
|
|
829, 845, 855, 865, 865, 855, 845, 829,
|
|
830, 846, 856, 866, 866, 856, 846, 830,
|
|
821, 840, 850, 859, 859, 850, 840, 821,
|
|
815, 833, 844, 853, 853, 844, 833, 815,
|
|
798, 817, 828, 839, 839, 828, 817, 798
|
|
},
|
|
{ // Rook
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281,
|
|
1281, 1281, 1281, 1281, 1281, 1281, 1281, 1281
|
|
},
|
|
{ // Queen
|
|
2478, 2504, 2516, 2528, 2528, 2516, 2504, 2478,
|
|
2504, 2528, 2540, 2552, 2552, 2540, 2528, 2504,
|
|
2516, 2540, 2552, 2564, 2564, 2552, 2540, 2516,
|
|
2528, 2552, 2564, 2576, 2576, 2564, 2552, 2528,
|
|
2528, 2552, 2564, 2576, 2576, 2564, 2552, 2528,
|
|
2516, 2540, 2552, 2564, 2564, 2552, 2540, 2516,
|
|
2504, 2528, 2540, 2552, 2552, 2540, 2528, 2504,
|
|
2478, 2504, 2516, 2528, 2528, 2516, 2504, 2478
|
|
},
|
|
{ // King
|
|
18, 77, 105, 135, 135, 105, 77, 18,
|
|
77, 135, 165, 193, 193, 165, 135, 77,
|
|
105, 165, 193, 222, 222, 193, 165, 105,
|
|
135, 193, 222, 251, 251, 222, 193, 135,
|
|
135, 193, 222, 251, 251, 222, 193, 135,
|
|
105, 165, 193, 222, 222, 193, 165, 105,
|
|
77, 135, 165, 193, 193, 165, 135, 77,
|
|
18, 77, 105, 135, 135, 105, 77, 18
|
|
}
|
|
};
|
|
|
|
#endif // !defined(PSQTAB_H_INCLUDED)
|