Switch back to absolute royalty when value = -1
authorH.G. Muller <h.g.muller@hccnet.nl>
Tue, 2 Nov 2010 11:02:49 +0000 (12:02 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Tue, 2 Nov 2010 11:06:07 +0000 (12:06 +0100)
This is achieved by simulating we only have one such piece

data/fmax.ini
fairymax.c

index 26c1f56..a684c2e 100644 (file)
@@ -180,10 +180,11 @@ initial setup (where you specify them by number, not letter).
 \r
 Pieces with negative values are considered royal. If one side has more than\r
 one royal piece of the same type, he loses if the _last_ one is captured.\r
+This means any 'spare' royal pieces can be sacrificed, and the exchange\r
+value assumed for them will be the absolute value of what you defined.\r
+With a value -1, however, loss of the first piece of that type loses the game.\r
 For royal piece types larger than 7 there is the special rule that it is not\r
-allowed to leave more than one of them under attack. This means the 'spare'\r
-royal pieces can be sacrificed, and the exchange value assumed for them will\r
-be the absolute value of what you define for them.\r
+allowed to leave more than one of them under attack ('duple check').\r
 \r
 NOTE: piece value 181 for piece 7 is reserved for Makruk, and enables\r
 promotion on the 6th rank. Do not use it in other variants.\r
index 0c1fc81..0eaaf2d 100644 (file)
@@ -373,6 +373,8 @@ InitGame()
  K=BW;W(K--)\r
  {b[K]=oo[K+16]+16;b[K+112]=oo[K];b[K+16]=18;b[K+96]=1; /* initial board setup*/\r
   pl[oo[K+16]+16]++;pl[oo[K]]++;pl[18]++;pl[1]++;\r
+  if(w[oo[K+16]+16] == -1)pl[oo[K+16]+16]=1;\r
+  if(w[oo[K]] == -1)pl[oo[K]]=1;\r
   L=8;W(L--)b[16*L+K+257]=(K-BW/2)*(K-BW/2)+(L-3.5)*(L-3.5); /* center-pts table   */\r
  }                                                   /*(in unused half b[])*/\r
  Side = WHITE; Q=0; O=S;\r
@@ -813,6 +815,7 @@ int main(int argc, char **argv)
                                             break;\r
                                         }\r
                                         pl[BLACK+WHITE-color]++;pl[p+color]++;\r
+                                        if(w[p+color] == -1)pl[p+color]=1; // fake we have one if value = -1, to thwart extinction condition\r
                                         continue;\r
                                 }\r
                         }\r