Assign correct PST in all Shogi variants
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 7 Feb 2017 19:04:42 +0000 (20:04 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 7 Feb 2017 19:04:42 +0000 (20:04 +0100)
The available piece-square tables are now assigned dependent on the
variant, where a new variant-idexed table of strings indicates which
table goes with which piece.

dropper.c

index 95b7608..c6821fc 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -356,6 +356,15 @@ char *ptc[] = { // XBoard 4.9 piece-to-char table
   "S.....F..........^F.P........^S....L........C......RKs.....f..........^f.p........^s....l........c......rk"
 };
 
+char *pstType[] = {
+  "",
+  "307716 777718",
+  "3077160 7777187",
+  "3077160 7777187",
+  "3055676777060100 77100787777801",
+  "770076 100001"
+};
+
 typedef struct {
   int files, ranks, hand, zone;
   char *name;
@@ -606,6 +615,8 @@ printf("# variant %d: %s\n", v, variants[v].name);
        rookPST[22*r+f]    = rookPST[22*xr+f+11]    = 45*(xr < zone);
     }
 
+    for(f=0,p=pstType[v]; *p; p++,f++) if(*p == ' ') f = 15; else  PST[BLACK+f] = (PST[WHITE+f] = pstData + 22*11*(*p - '0')) + 11*(*p > '2'); 
+
     InitCaptureCodes(variants[v].codes);
     pinCodes = (v == 5 ? 0xFF2C : 0xFF1F); // rays along which pinning ispossible
 }