Invert storage of initial positions
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 28 Apr 2016 19:57:17 +0000 (21:57 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 28 Apr 2016 19:57:17 +0000 (21:57 +0200)
The initial positions are now stored high-rank to low-rank, rather
than starting with rank 0, and the Setup routine scans the board
accordingly. This to make Setup more like a FEN reader. The setboard
command is broken by this.

hachu.c

diff --git a/hachu.c b/hachu.c
index ae5a8d5..98b776e 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -470,26 +470,26 @@ PieceDesc wolfPieces[] = {
   { NULL }  // sentinel\r
 };\r
 \r
-char chuArray[] = "L:FLCSGK:DEGSC:FLL/:RV1B1:BT:KN:PH:BT1B1:RV/:SM:VMR:DH:DK:LN:FK:DK:DHR:VM:SM/PPPPPPPPPPPP/3:GB4:GB3"\r
+char chuArray[] = "l:flcsg:dekgsc:fll/:rv1b1:bt:ph:kn:bt1b1:rv/:sm:vmr:dh:dk:fk:ln:dk:dhr:vm:sm/pppppppppppp/3:gb4:gb3"\r
                  "/12/12/"\r
-                 "3:gb4:gb3/pppppppppppp/:sm:vmr:dh:dk:fk:ln:dk:dhr:vm:sm/:rv1b1:bt:ph:kn:bt1b1:rv/l:flcsg:dekgsc:fll";\r
-char daiArray[] = "LN:STICSGKGSCI:STNL/:RV1:CS1:FL1:BT:DE:BT1:FL1:CS1:RV/1:VO1:AB1:EW:KN:LN:PH:EW1:AB1:VO1/R:FD:SM:VMB:DH:DK:FK:DK:DHB:VM:SM:FDR"\r
-                 "/PPPPPPPPPPPPPPP/4:GB5:GB4/15/15/15/4:gb5:gb4/ppppppppppppppp/"\r
-                 "r:fd:sm:vmb:dh:dk:fk:dk:dhb:vm:sm:fdr/1:vo1:ab1:ew:ph:ln:kn:ew1:ab1:vo1/:rv1:cs1:fl1:bt:de:bt1:fl1:cs1:rv/ln:sticsgkgsci:stnl";\r
-char tenArray[] = "LN:FLICSGK:DEGSCI:FLNL/:RV1:CS:CS1:BT:KN:LN:FK:PH:BT1:CS:CS1:RV/:SS:VSB:DH:DK:WB:FI:LH:FE:FI:WB:DK:DHB:VS:SS/"\r
-                 ":SM:VMR:HF:SE:BG:RG:GG:VG:RG:BG:SE:HFR:VM:SM/PPPPPPPPPPPPPPPP/4D6D4/"\r
+                 "3:GB4:GB3/PPPPPPPPPPPP/:SM:VMR:DH:DK:LN:FK:DK:DHR:VM:SM/:RV1B1:BT:KN:PH:BT1B1:RV/L:FLCSGK:DEGSC:FLL";\r
+char daiArray[] = "ln:sticsgkgsci:stnl/:rv1:cs1:fl1:bt:de:bt1:fl1:cs1:rv/1:vo1:ab1:ew:ph:ln:kn:ew1:ab1:vo1/r:fd:sm:vmb:dh:dk:fk:dk:dhb:vm:sm:fdr/"\r
+                 "ppppppppppppppp/4:gb5:gb4/15/15/15/4:GB5:GB4/PPPPPPPPPPPPPPP/"\r
+                 "R:FD:SM:VMB:DH:DK:FK:DK:DHB:VM:SM:FDR/1:VO1:AB1:EW:KN:LN:PH:EW1:AB1:VO1/:RV1:CS1:FL1:BT:DE:BT1:FL1:CS1:RV/LN:STICSGKGSCI:STNL";\r
+char tenArray[] = "ln:flicsg:dekgsci:flnl/:rv1:cs:cs1:bt:ph:fk:ln:kn:bt1:cs:cs1:rv/:ss:vsb:dh:dk:wb:fi:fe:lh:fi:wb:dk:dhb:vs:ss/"\r
+                 ":sm:vmr:hf:se:bg:rg:vg:gg:rg:bg:se:hfr:vm:sm/pppppppppppppppp/4d6d4/"\r
                  "16/16/16/16/"\r
-                 "4d6d4/pppppppppppppppp/:sm:vmr:hf:se:bg:rg:vg:gg:rg:bg:se:hfr:vm:sm/"\r
-                 ":ss:vsb:dh:dk:wb:fi:fe:lh:fi:wb:dk:dhb:vs:ss/:rv1:cs:cs1:bt:ph:fk:ln:kn:bt1:cs:cs1:rv/ln:flicsg:dekgsci:flnl";\r
-char shoArray[] = "LNSGKGSNL/1B2:DE2R1/PPPPPPPPP/9/9/9/ppppppppp/1r2:de2b1/lnsgkgsnl";\r
-char waArray[] = ":PH:DKCG:EWK:VML:KN:SM:DH/1:FL3S3:DE1/PPP:BTPPPRPPP/3P3P3"\r
-                "/11/11/11"\r
-                "/3p3p3/ppprppp:btppp/1:de3s3:fl1/:dh:sm:knl:vmk:ewgc:dk:ph";\r
-char chessArray[] = "RNB:FKKBNR/PPPPPPPP/8/8/8/8/pppppppp/rnb:fkkbnr";\r
-char lionArray[]  = "R:LNB:FKKBNR/PPPPPPPP/8/8/8/8/pppppppp/r:lnb:fkkbnr";\r
-char shatArray[]= "RNBK:FKBNR/PPPPPPPP/8/8/8/8/pppppppp/rnbk:fkbnr";\r
-char thaiArray[]= "RNSK:SMSNR/8/PPPPPPPP/8/8/pppppppp/8/rns:smksnr";\r
-char wolfArray[]= "RNB:EWKBNR/PPPPPPPP/8/8/8/8/pppppppp/rnb:ewkbnr";\r
+                 "4D6D4/PPPPPPPPPPPPPPPP/:SM:VMR:HF:SE:BG:RG:GG:VG:RG:BG:SE:HFR:VM:SM/"\r
+                 ":SS:VSB:DH:DK:WB:FI:LH:FE:FI:WB:DK:DHB:VS:SS/:RV1:CS:CS1:BT:KN:LN:FK:PH:BT1:CS:CS1:RV/LN:FLICSGK:DEGSCI:FLNL";\r
+char shoArray[] = "lnsgkgsnl/1r2:de2b1/ppppppppp/9/9/9/PPPPPPPPP/1B2:DE2R1/LNSGKGSNL";\r
+char waArray[] = ":dh:sm:knl:vmk:ewgc:dk:ph/1:de3s3:fl1/ppprppp:btppp/3p3p3"\r
+                "/11/11/11/"\r
+                "3P3P3/PPP:BTPPPRPPP/1:FL3S3:DE1/:PH:DKCG:EWK:VML:KN:SM:DH";\r
+char chessArray[] = "rnb:fkkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNB:FKKBNR";\r
+char lionArray[]  = "r:lnb:fkkbnr/pppppppp/8/8/8/8/PPPPPPPP/R:LNB:FKKBNR";\r
+char shatArray[]= "rnbk:fkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBK:FKBNR";\r
+char thaiArray[]= "rns:smksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSK:SMSNR";\r
+char wolfArray[]= "rnb:ewkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNB:EWKBNR";\r
 \r
 typedef struct {\r
   int boardWidth, boardFiles, boardRanks, zoneDepth, varNr; // board sizes\r
@@ -873,7 +873,7 @@ SetUp (char *array, int var)
   PieceDesc *p1, *p2;\r
   last[WHITE] = 1; last[BLACK] = 0;\r
   royal[WHITE] = royal[BLACK] = 0;\r
-  for(i=0; ; i++) {\r
+  for(i=BH-1; ; i--) {\r
 //printf("next rank: %s\n", array);\r
     for(j = BW*i; ; j++) {\r
       int pflag=0;\r