Skip to content

Commit 816bd31

Browse files
committed
MinimalChess 0.3.6.0 Pesto (Baseline)
1 parent 704fe44 commit 816bd31

File tree

4 files changed

+106
-102
lines changed

4 files changed

+106
-102
lines changed

MinimalChess/Evaluation.cs

Lines changed: 103 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static int Evaluate(Board board)
2929
endGame += (int)color * EndgameTables[pieceIndex, squareIndex];
3030
}
3131

32-
double factor = Linstep(518, 6192, phase);
32+
double factor = Linstep(Endgame, Midgame, phase);
3333
double score = factor * midGame + (1 - factor) * endGame;
3434
return (int)score;
3535
}
@@ -38,132 +38,136 @@ public static double Linstep(double edge0, double edge1, double v)
3838
{
3939
return Math.Min(1, Math.Max(0, (v - edge0) / (edge1 - edge0)));
4040
}
41+
/* PeSTO
42+
*/
43+
static readonly int Midgame = 6192;
44+
static readonly int Endgame = 518;
4145

42-
static int[] PhaseValues = new int[6] { 0, 337, 365, 477, 1025, 0 };
46+
static readonly int[] PhaseValues = new int[6] { 0, 337, 365, 477, 1025, 0 };
4347

44-
static int[,] MidgameTables = new int[6, 64]{
48+
static readonly int[,] MidgameTables = new int[6, 64]{
4549
{ //PAWN
46-
100, 100, 100, 100, 100, 100, 100, 100,
47-
220, 250, 135, 220, 255, 275, 190, 125,
48-
105, 115, 125, 130, 155, 165, 125, 90,
49-
80, 105, 95, 110, 110, 100, 105, 65,
50-
70, 90, 80, 95, 100, 85, 90, 65,
51-
70, 85, 80, 75, 85, 80, 115, 75,
52-
60, 90, 65, 60, 65, 100, 115, 65,
53-
100, 100, 100, 100, 100, 100, 100, 100,
50+
82, 82, 82, 82, 82, 82, 82, 82,
51+
180, 216, 143, 177, 150, 208, 116, 71,
52+
76, 89, 108, 113, 147, 138, 107, 62,
53+
68, 95, 88, 103, 105, 94, 99, 59,
54+
55, 80, 77, 94, 99, 88, 92, 57,
55+
56, 78, 78, 72, 85, 85, 115, 70,
56+
47, 81, 62, 59, 67, 106, 120, 60,
57+
82, 82, 82, 82, 82, 82, 82, 82,
5458
},
5559
{ //KNIGHT MG
56-
105, 175, 240, 230, 325, 170, 245, 170,
57-
225, 250, 370, 315, 325, 350, 305, 290,
58-
240, 365, 335, 360, 375, 415, 375, 345,
59-
295, 320, 320, 355, 340, 365, 320, 315,
60-
290, 310, 315, 315, 330, 325, 320, 295,
61-
280, 295, 315, 320, 320, 320, 325, 290,
62-
275, 255, 295, 300, 305, 320, 300, 290,
63-
230, 280, 255, 270, 290, 280, 285, 285,
60+
170, 248, 303, 288, 398, 240, 322, 230,
61+
264, 296, 409, 373, 360, 399, 344, 320,
62+
290, 397, 374, 402, 421, 466, 410, 381,
63+
328, 354, 356, 390, 374, 406, 355, 359,
64+
324, 341, 353, 350, 365, 356, 358, 329,
65+
314, 328, 349, 347, 356, 354, 362, 321,
66+
308, 284, 325, 334, 336, 355, 323, 318,
67+
232, 316, 279, 304, 320, 309, 318, 314,
6468
},
6569
{ //BISHOP MG
66-
255, 300, 215, 225, 270, 275, 335, 325,
67-
280, 340, 315, 295, 355, 385, 350, 290,
68-
310, 345, 375, 355, 355, 355, 360, 325,
69-
325, 330, 350, 370, 355, 370, 335, 325,
70-
325, 340, 340, 345, 360, 335, 335, 330,
71-
330, 340, 340, 345, 335, 350, 340, 335,
72-
335, 340, 345, 325, 335, 350, 355, 330,
73-
315, 330, 310, 320, 325, 315, 300, 310,
70+
336, 369, 283, 328, 340, 323, 372, 357,
71+
339, 381, 347, 352, 395, 424, 383, 318,
72+
349, 402, 408, 405, 400, 415, 402, 363,
73+
361, 370, 384, 415, 402, 402, 372, 363,
74+
359, 378, 378, 391, 399, 377, 375, 369,
75+
365, 380, 380, 380, 379, 392, 383, 375,
76+
369, 380, 381, 365, 372, 386, 398, 366,
77+
332, 362, 351, 344, 352, 353, 326, 344,
7478
},
7579
{ //ROOK MG
76-
560, 615, 525, 535, 545, 505, 475, 535,
77-
510, 510, 560, 515, 570, 550, 490, 500,
78-
495, 530, 515, 520, 500, 545, 540, 500,
79-
470, 505, 505, 530, 525, 520, 485, 485,
80-
475, 490, 495, 490, 500, 485, 500, 475,
81-
465, 485, 485, 485, 495, 495, 495, 475,
82-
460, 490, 485, 490, 495, 505, 490, 435,
83-
480, 490, 495, 505, 505, 495, 470, 475,
80+
509, 519, 509, 528, 540, 486, 508, 520,
81+
504, 509, 535, 539, 557, 544, 503, 521,
82+
472, 496, 503, 513, 494, 522, 538, 493,
83+
453, 466, 484, 503, 501, 512, 469, 457,
84+
441, 451, 465, 476, 486, 470, 483, 454,
85+
432, 452, 461, 460, 480, 477, 472, 444,
86+
433, 461, 457, 468, 476, 488, 471, 406,
87+
458, 464, 478, 494, 493, 484, 440, 451,
8488
},
8589
{ //QUEEN MG
86-
845, 875, 905, 915, 1025, 1035, 885, 890,
87-
875, 860, 910, 900, 885, 950, 925, 935,
88-
890, 895, 910, 915, 935, 950, 940, 945,
89-
880, 880, 895, 895, 905, 920, 905, 905,
90-
895, 885, 895, 895, 905, 905, 915, 905,
91-
890, 905, 900, 900, 900, 905, 920, 910,
92-
875, 895, 910, 905, 910, 915, 905, 895,
93-
910, 890, 895, 910, 890, 880, 885, 880,
90+
997, 1025, 1054, 1037, 1084, 1069, 1068, 1070,
91+
1001, 986, 1020, 1026, 1009, 1082, 1053, 1079,
92+
1012, 1008, 1032, 1033, 1054, 1081, 1072, 1082,
93+
998, 998, 1009, 1009, 1024, 1042, 1023, 1026,
94+
1016, 999, 1016, 1015, 1023, 1021, 1028, 1022,
95+
1011, 1027, 1014, 1023, 1020, 1027, 1039, 1030,
96+
990, 1017, 1036, 1027, 1033, 1040, 1022, 1026,
97+
1024, 1007, 1016, 1035, 1010, 1000, 994, 975,
9498
},
9599
{ //KING MG
96-
0, 0, 0, 0, 0, 0, 0, 0,
97-
0, 0, 0, 0, 0, 0, 0, 0,
98-
-25, -25, 0, 0, 0, 0, 0, -25,
99-
-25, -25, -25, 25, -25, 25, -25, -25,
100-
-25, -25, -25, -25, -25, -25, -25, -25,
101-
0, -20, -25, -25, -25, -25, -20, -25,
102-
5, 10, -15, -75, -50, -10, 25, 20,
103-
-20, 45, 20, -40, 10, -15, 35, 30,
100+
-65, 23, 16, -15, -56, -34, 2, 13,
101+
29, -1, -20, -7, -8, -4, -38, -29,
102+
-9, 24, 2, -16, -20, 6, 22, -22,
103+
-17, -20, -12, -27, -30, -25, -14, -36,
104+
-49, -1, -27, -39, -46, -44, -33, -51,
105+
-14, -14, -22, -46, -44, -30, -15, -27,
106+
1, 7, -8, -64, -43, -16, 9, 8,
107+
-15, 36, 12, -54, 8, -28, 24, 14,
104108
}
105109
};
106110

107111
static int[,] EndgameTables = new int[6, 64]{
108112
{ //PAWN EG
109-
100, 100, 100, 100, 100, 100, 100, 100,
110-
255, 255, 225, 215, 220, 220, 235, 250,
111-
170, 175, 165, 150, 145, 140, 165, 160,
112-
115, 110, 105, 100, 95, 95, 105, 100,
113-
95, 100, 90, 90, 85, 85, 90, 85,
114-
90, 95, 85, 90, 90, 85, 90, 80,
115-
95, 100, 90, 90, 90, 90, 95, 80,
116-
100, 100, 100, 100, 100, 100, 100, 100,
113+
94, 94, 94, 94, 94, 94, 94, 94,
114+
272, 267, 252, 228, 241, 226, 259, 281,
115+
188, 194, 179, 161, 150, 147, 176, 178,
116+
126, 118, 107, 99, 92, 98, 111, 111,
117+
107, 103, 91, 87, 87, 86, 97, 93,
118+
98, 101, 88, 95, 94, 89, 93, 86,
119+
107, 102, 102, 104, 107, 94, 96, 87,
120+
94, 94, 94, 94, 94, 94, 94, 94,
117121
},
118122
{ //KNIGHT EG
119-
215, 235, 265, 245, 250, 240, 225, 190,
120-
245, 260, 265, 275, 270, 260, 255, 235,
121-
250, 270, 290, 290, 280, 285, 265, 245,
122-
265, 275, 295, 295, 290, 295, 275, 260,
123-
255, 270, 290, 295, 290, 290, 275, 255,
124-
255, 275, 275, 290, 285, 275, 260, 255,
125-
240, 255, 270, 275, 275, 265, 260, 230,
126-
240, 240, 250, 260, 260, 260, 245, 225,
123+
223, 243, 268, 253, 250, 254, 218, 182,
124+
256, 273, 256, 279, 272, 256, 257, 229,
125+
257, 261, 291, 290, 280, 272, 262, 240,
126+
264, 284, 303, 303, 303, 292, 289, 263,
127+
263, 275, 297, 306, 297, 298, 285, 263,
128+
258, 278, 280, 296, 291, 278, 261, 259,
129+
239, 261, 271, 276, 279, 261, 258, 237,
130+
252, 230, 258, 266, 259, 263, 231, 217,
127131
},
128132
{ //BISHOP EG
129-
275, 275, 275, 285, 285, 285, 280, 275,
130-
280, 290, 295, 280, 295, 290, 290, 280,
131-
290, 290, 300, 295, 290, 305, 295, 290,
132-
290, 295, 305, 305, 305, 305, 290, 290,
133-
285, 295, 300, 310, 300, 300, 290, 290,
134-
285, 290, 300, 300, 300, 295, 290, 280,
135-
280, 285, 290, 290, 295, 290, 290, 275,
136-
275, 285, 285, 285, 285, 275, 280, 280,
133+
283, 276, 286, 289, 290, 288, 280, 273,
134+
289, 293, 304, 285, 294, 284, 293, 283,
135+
299, 289, 297, 296, 295, 303, 297, 301,
136+
294, 306, 309, 306, 311, 307, 300, 299,
137+
291, 300, 310, 316, 304, 307, 294, 288,
138+
285, 294, 305, 307, 310, 300, 290, 282,
139+
283, 279, 290, 296, 301, 288, 282, 270,
140+
274, 288, 274, 292, 288, 281, 292, 280,
137141
},
138142
{ //ROOK EG
139-
500, 500, 505, 505, 505, 500, 500, 500,
140-
500, 500, 505, 505, 495, 500, 495, 495,
141-
490, 495, 495, 495, 495, 490, 495, 490,
142-
485, 490, 500, 495, 495, 495, 485, 485,
143-
485, 490, 490, 490, 485, 485, 480, 475,
144-
480, 485, 480, 485, 480, 480, 480, 475,
145-
480, 485, 485, 490, 480, 485, 480, 475,
146-
485, 485, 490, 490, 490, 480, 480, 475,
143+
525, 522, 530, 527, 524, 524, 520, 517,
144+
523, 525, 525, 523, 509, 515, 520, 515,
145+
519, 519, 519, 517, 516, 509, 507, 509,
146+
516, 515, 525, 513, 514, 513, 511, 514,
147+
515, 517, 520, 516, 507, 506, 504, 501,
148+
508, 512, 507, 511, 505, 500, 504, 496,
149+
506, 506, 512, 514, 503, 503, 501, 509,
150+
503, 514, 515, 511, 507, 499, 516, 492,
147151
},
148152
{ //QUEEN EG
149-
910, 925, 940, 935, 935, 930, 925, 935,
150-
900, 910, 925, 930, 930, 935, 925, 925,
151-
900, 920, 920, 945, 935, 925, 925, 915,
152-
915, 925, 930, 935, 935, 930, 940, 925,
153-
905, 920, 925, 940, 930, 935, 925, 915,
154-
900, 915, 930, 930, 925, 925, 910, 915,
155-
905, 915, 925, 915, 930, 915, 905, 875,
156-
905, 930, 905, 915, 915, 910, 905, 895,
153+
927, 958, 958, 963, 963, 955, 946, 956,
154+
919, 956, 968, 977, 994, 961, 966, 936,
155+
916, 942, 945, 985, 983, 971, 955, 945,
156+
939, 958, 960, 981, 993, 976, 993, 972,
157+
918, 964, 955, 983, 967, 970, 975, 959,
158+
920, 909, 951, 942, 945, 953, 946, 941,
159+
914, 913, 906, 920, 920, 913, 900, 904,
160+
903, 908, 914, 893, 931, 904, 916, 895,
157161
},
158162
{ //KING EG
159-
-60, -25, -10, -15, -5, 10, 10, -10,
160-
-5, 15, 15, 15, 15, 30, 20, 10,
161-
10, 20, 20, 15, 20, 40, 40, 10,
162-
-5, 20, 20, 25, 20, 30, 25, 5,
163-
-20, 0, 15, 20, 20, 20, 10, -10,
164-
-15, 0, 10, 15, 20, 15, 10, -5,
165-
-20, -5, 5, 5, 10, 5, 0, -10,
166-
-45, -25, -15, -15, -10, -10, -15, -35,
163+
-74, -35, -18, -18, -11, 15, 4, -17,
164+
-12, 17, 14, 17, 17, 38, 23, 11,
165+
10, 17, 23, 15, 20, 45, 44, 13,
166+
-8, 22, 24, 27, 26, 33, 26, 3,
167+
-18, -4, 21, 24, 27, 23, 9, -11,
168+
-19, -3, 11, 21, 23, 16, 7, -9,
169+
-27, -11, 4, 13, 14, 4, -5, -17,
170+
-53, -34, -21, -11, -28, -14, -24, -43,
167171
}};
168172
}
169173
}

MinimalChessBoard/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private static void Print(Board board, Move move = default)
117117
Console.WriteLine($"|{rank + 1}"); //ranks aren't zero-indexed
118118
}
119119
Console.WriteLine(" '----------------'");
120-
Console.WriteLine($" A B C D E F G H {PeSTO.Evaluate(board):+0.00;-0.00}");
120+
Console.WriteLine($" A B C D E F G H {Evaluation.Evaluate(board):+0.00;-0.00}");
121121
}
122122

123123
private static void SetColor(Piece piece, int rank, int file, Move move)

MinimalChessEngine/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace MinimalChessEngine
66
{
77
public static class Program
88
{
9-
const string NAME_VERSION = "MinimalChess 0.3.6";
9+
const string NAME_VERSION = "MinimalChess 0.3.6.0 Pesto";
1010

1111
static Engine _engine = new Engine();
1212
static async Task Main(string[] args)

MinimalChessEngine/Properties/PublishProfiles/Windows x64.pubxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
88
<Configuration>Release</Configuration>
99
<Platform>Any CPU</Platform>
1010
<TargetFramework>netcoreapp3.1</TargetFramework>
11-
<PublishDir>D:\Projekte\Chess\Builds\MinimalChess 0.3.6 Windows</PublishDir>
11+
<PublishDir>D:\Projekte\Chess\Builds\MinimalChess 0.3.6.0 Windows</PublishDir>
1212
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1313
<SelfContained>true</SelfContained>
1414
<PublishSingleFile>True</PublishSingleFile>

0 commit comments

Comments
 (0)