Reorder pieces, and define values for all variants
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 28 Dec 2016 15:47:23 +0000 (16:47 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 28 Dec 2016 15:58:52 +0000 (16:58 +0100)
Lance now immediately follows Pawn, so that they can be taken out of the
droppable set together when calculating evasion drops on last rank. The
downside is that the Lance will participate in mini- and Judkins' Shogi
as a non-present piece. The piece IDs of Wa Shogi are changed to conform
with Sjaak II's assigment,and the startup FEN is changed accordingly.
Piece values are assigned for all variants.

dropper.c

index 31df0fa..1e2516f 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -280,46 +280,38 @@ signed char steps[] = {
 // organized in four sections, each terminated by 255: unprom white, prom white, unprom black, prom black
 // first of unprom section is always king (which in reality is type 31, while unprom = 0-15 and prom = 16-31)
 
-int normalValue[] = {0, 10, 50, 130, 150, 60, 80, 90,     0, 110, 96, 155, 180, 94, 92, 90,   // basic and promoted
-                     0, 20, 60, 150, 170, 75, 88, 90,     0,  20, 90, 165, 190, 95,100,110 }; // pre-promoted and in hand
-int euroValue[]   = {0, 10, 50, 130, 150, 80, 80, 90,     0, 110, 96, 155, 180, 94, 92, 90,   // basic and promoted
-                     0, 20, 60, 150, 170, 80, 88, 90,     0,  20, 90, 165, 190, 95,100,110 }; // pre-promoted and in hand
-int miniValue[]  = {0, 20, 50,  81, 110, 60, 65, 79,     0,  99, 96, 125, 140, 94, 80, 79,   // basic and promoted
-                    0, 20, 60, 120, 135, 70, 79, 79,     0,  40, 90, 105, 130, 95, 81, 84 }; // pre-promoted and in hand
-int judkinValue[] = {0, 20, 50,  96, 115, 40, 65, 79,     0,  99, 96, 140, 155, 81, 80, 79,   // basic and promoted
-                     0, 20, 60, 135, 150, 70, 79, 79,     0,  25, 90, 120, 135, 70, 81, 84 }; // pre-promoted and in hand
-int toriValue[] =   {0, 20,  0,  70,  70, 40, 90, 79,     0,  50,  0,   0,   0,  0,150, 79,   // basic and promoted
-                     0, 20,  0,  70,  70, 40,140, 79,     0,  25,  0, 100, 100, 60,130,100 }; // pre-promoted and in hand
 int
-chessValues[] = { 100, 315, 300, 375, 600, -1, 700, 340, 325, 450, -1, 150, 385, 350, 400, 600, -1 },
-shogiValues[] = { 10, 80, 90, 130, 150, 50, 60, -1, 110, 92, 90, 155, 180, 96, 94, -1, 20, 100, 110, 165, 190, 90, 95, -1 },
-miniValues[]  = { 20, 65, 79, 81, 110, -1, 99, 80, 79, 125, 140, -1, 40, 81, 84, 105, 130, -1 },
-judkinValues[]  = { -1, -1, -1 },
-toriValues[]  = { -1, -1, -1 },
-waValues[]  = { -1, -1, -1 };
+chessValues[] = { 100, 285, 290, 375, 600, -1, 700, 310, 315, 450, -1, 150, 320, 305, 400, 600, -1 },
+shogiValues[]   = { 30, 150, 240, 270, 390, 450, 180, -1, 330, 288, 276, 270, 465, 540, 282, -1,  60, 270, 300, 330, 495, 570, 285, -1 },
+miniValues[]    = { 60, 110, 195, 237, 243, 330,      -1, 297, 245, 240, 237, 375, 420,      -1, 120, 200, 243, 252, 315, 390, -1 },
+judkinValues[]  = { 50, 115, 240, 270, 325, 390, 180, -1, 330, 245, 276, 270, 420, 480, 282, -1,  60, 220, 300, 330, 450, 510, 285, -1 },
+toriValues[]  = { 60, 100, 150, 150, 237, 300, -1, 90, 0, 0, 0, 0, 0, 500, -1, 65, 150, 200, 200, 300, 400, -1 },
+waValues[]  = { 30, 210, 210, 180, 210, 210, 210, 240, 270, 160, 175, 270, 300, 360, 540, 480, -1,
+               330, 360, 480, 360, 240, 270, 270, 300, 330, 330, 270, 360, 540, 540, -1,
+               60, 240, 300, 270, 255, 270, 240, 285, 330, 270, 285, 345, 480, 480, 630, 480, -1 };
 
 unsigned char
 chessDirs[] = { 40, 49, 4, 35, 26, 13, 255, 13, 4, 35, 26, 255, 40, 53, 4, 35, 26, 13, 255, 13, 4, 35, 26, 255 }, // K,P,N,B,R,Q / Q~,N~,B~,R~
-shogiDirs[] = { 40, 69, 87, 57, 35, 26, 186, 97, 255, 57, 57, 57, 31, 22, 57, 57, 255,   // K,P,S,G,B,R,N,L / +P,+S,-,DH,DK,+N,+L
-               40, 62, 43, 64, 35, 26,  10, 94, 255, 64, 64, 64, 31, 22, 64, 64, 255 },
-toriDirs[]  = { 40, 69, 189, 197, 201, 42, 79, 255, 108, 0, 0, 0, 0, 168, 255,   // Ph, S, Pt, Ql, Qr, Cr, Fa / G - - - - Ea
-                40, 62, 193, 205, 209, 42, 71, 255, 112, 0, 0, 0, 0, 177, 255 },
-waDirs[] = { 40, 69, 67, 67, 74, 59, 59, 73, 87, 57, 97, 96, 116, 121, 135, 99, 150, 255, // CK,SP,SC,SO,FC,CM,FG,BD,VS,VW,OC,LH,SW,RR,FF,Tr,CE 
-                 57,135,150,213, 87,116, 57, 79, 40, 40,  8,  26,  99, 141, 255,          //    GB,FF,CE,RF,VS,SW,VW,RB,BE,PO,HH,GS,Tr,TF
-             40, 62, 60, 60, 82, 66, 66, 81, 43, 64, 94, 93, 116, 128,  34, 99, 159, 255,
-                 64, 34,159,220, 43,116, 64, 71, 40, 40,  8,  26,  99, 141, 255 },
+shogiDirs[] = { 40, 69, 97, 87, 57, 35, 26, 186, 255, 57, 57, 57, 57, 31, 22, 57, 255,   // K,P,S,G,B,R,L,N / +P,+S,-,DH,DK,+N,+L
+               40, 62, 94, 43, 64, 35, 26, 10, 255, 64, 64, 64, 64, 31, 22, 64, 255 },
+toriDirs[]  = { 40, 69, 189, 197, 201, 42, 79, 255, 112, 0, 0, 0, 0, 168, 255,   // Ph, S, Pt, Ql, Qr, Cr, Fa / G - - - - Ea
+                40, 62, 193, 205, 209, 42, 71, 255, 108, 0, 0, 0, 0, 177, 255 },
+waDirs[] = { 40, 69, 97, 67, 67, 74, 59, 59, 73, 87, 57, 96, 116, 121, 135, 99, 150, 255, // CK,SP,SC,SO,FC,CM,FG,BD,VS,VW,OC,LH,SW,RR,FF,Tr,CE 
+                 57, 40,135,150,213, 87,116, 57, 79, 40,  8,  26,  99, 141, 255,          //    GB,FF,CE,RF,VS,SW,VW,RB,BE,PO,HH,GS,Tr,TF
+             40, 62, 94, 60, 60, 82, 66, 66, 81, 43, 64, 93, 116, 128,  34, 99, 159, 255,
+                 64, 40, 34,159,220, 43,116, 64, 71, 40,  8,  26,  99, 141, 255 },
 
 chessIDs[] = "PNBRQ",
-shogiIDs[] = "PSGBRNL",
+shogiIDs[] = "PLSGBRN",
 toriIDs[]  = "SPLRCF",
-waIDs[]    = "PCOQMGDSVLHWRFXE",
+waIDs[]    = "POULCMGDVWHSRFXE",
 
 chessFEN[] = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -",
 shogiFEN[] = "lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL w",
 toriFEN[]  = "rpckcpl/3f3/sssssss/2s1S2/SSSSSSS/3F3/LPCKCPR w",
-waFEN[]    = "hmoqskvgcdl/1e3w3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3W3E1/LDCGVKSQOMH w",
+waFEN[]    = "hmlcvkwgudo/1e3s3f1/ppprpppxppp/3p3p3/11/11/11/3P3P3/PPPXPPPRPPP/1F3S3E1/ODUGWKVCLMH w",
 miniFEN[]  = "rbsgk/4p/5/P4/KGSBR w",
-judkinFEN[]= "rnbsgk/5p/6/6/P5/KGSBNR w",
+judkinFEN[]= "rbnsgk/5p/6/6/P5/KGSNBR w",
 euroFEN[]  = "r w",
 
 // promotion codes for unpromoted pieces. Will be ANDed with Z_WHITE or Z_BLACK to fill promoCode[] table
@@ -333,9 +325,9 @@ euroFEN[]  = "r w",
 #define Z_DOUBLE 0x80   /* where Pawns have double step */
 
 chessProms[16] = { Z_FIDE|Z_MUST },
-shogiProms[16] = { Z_MUST, COLOR, 0, Z_MUST, Z_MUST, Z_2ND, Z_2ND },
+shogiProms[16] = { Z_MUST, Z_2ND, COLOR, 0, Z_MUST, Z_MUST, Z_2ND },
 toriProms[16]  = { Z_MUST, 0, 0, 0, 0, Z_MUST },
-waProms[16]    = { Z_MUST, Z_MUST, Z_MUST, Z_MUST, COLOR, COLOR, Z_MUST, Z_MUST, Z_MUST, COLOR, COLOR, Z_MUST, Z_MUST, Z_MUST };
+waProms[16]    = { Z_MUST, Z_2ND, Z_MUST, Z_MUST, Z_MUST, COLOR, COLOR, Z_MUST, Z_MUST, Z_MUST, COLOR, Z_MUST, COLOR, Z_MUST };
 
 typedef struct {
   int files, ranks, hand, zone;
@@ -433,6 +425,8 @@ printf("# variant %d: %s\n", v, variants[v].name);
     startPos= variants[v].fen;
     codes   = variants[v].proms;
 
+    maxDrop += (v==2 || v==1); // Judkins & mini-Shogi have dummy Lance
+
     // board
     ClearBoard();
     boardEnd = specials = 22*nrRanks;