Use a generic PSQT for fairy pieces
authorFabian Fichter <ianfab@users.noreply.github.com>
Tue, 1 Jan 2019 15:53:55 +0000 (16:53 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Tue, 1 Jan 2019 15:56:22 +0000 (16:56 +0100)
Give a bonus for squares closer to the center of the board.

shogi
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 1068 W: 578 L: 462 D: 28

minishogi
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 1098 W: 577 L: 464 D: 57

courier
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 396 W: 137 L: 65 D: 194

giveaway STC
LLR: 2.96 (-2.94,2.94) [-10.00,5.00]
Total: 2177 W: 863 L: 822 D: 492
http://35.161.250.236:6543/tests/view/5c2a44ad6e23db2472895687

extinction STC (failed)
LLR: -2.96 (-2.94,2.94) [-10.00,5.00]
Total: 1002 W: 436 L: 508 D: 58
http://35.161.250.236:6543/tests/view/5c2a44bf6e23db2472895689

shatranj STC (failed)
LLR: -3.00 (-2.94,2.94) [-10.00,5.00]
Total: 1891 W: 242 L: 289 D: 1360

src/psqt.cpp

index 1b7a17f..653bc08 100644 (file)
@@ -140,7 +140,10 @@ void init(const Variant* v) {
       for (Square s = SQ_A1; s <= SQ_MAX; ++s)
       {
           File f = std::max(std::min(file_of(s), File(v->maxFile - file_of(s))), FILE_A);
-          psq[ pc][ s] = score + (pt == KING ? KingBonus[std::min(rank_of(s), RANK_8)][std::min(f, FILE_D)] : Bonus[pc][std::min(rank_of(s), RANK_8)][std::min(f, FILE_D)]);
+          Rank r = rank_of(s);
+          psq[ pc][ s] = score + (  pt == KING  ? KingBonus[std::min(r, RANK_8)][std::min(f, FILE_D)]
+                                  : pt <= QUEEN ? Bonus[pc][std::min(r, RANK_8)][std::min(f, FILE_D)]
+                                                : make_score(5, 5) * (2 * f + std::max(std::min(r, Rank(v->maxRank - r)), RANK_1) - 8));
           psq[~pc][~s] = -psq[pc][s];
       }
       // pieces in pocket