From 165248b746cab04ad07b3a84056097eb676c5682 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 1 Nov 2010 13:09:34 +0100 Subject: [PATCH] Save total material with setup position The total-material counter R, which determines the game stage, was not saved with a setup position, so that 'undo' could mess it up. The piece counters for each side, in pl[], are now saved in a loop, rather than just the WHITE and BLACK element, and is extended to 32 elements. --- fairymax.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fairymax.c b/fairymax.c index 3b2db59..35d785b 100644 --- a/fairymax.c +++ b/fairymax.c @@ -101,7 +101,7 @@ char *inifile = INI_FILE; int Ticks, tlim, Setup, SetupQ; int GameHistory[1024]; -char HistoryBoards[1024][STATE], setupPosition[131]; +char HistoryBoards[1024][STATE], setupPosition[162]; int GamePtr, HistPtr; #define W while @@ -119,7 +119,7 @@ oo[32], /* initial piece setup */ of[256], od[16]; /* 1st dir. in o[] per piece*/ -signed char L,pl[17], +signed char L,pl[32], b[513], /* board: 16x8+dummy, + PST */ T[4104], /* hash translation table */ centr[32], @@ -735,9 +735,9 @@ int main(int argc, char **argv) InitGame(); if(Setup) { for(i=0; i<128; i++) b[i] = setupPosition[i]; + for(i=0; i<32; i++) pl[i] = setupPosition[i+130]; Side = setupPosition[128]; Q = SetupQ; - pl[WHITE] = setupPosition[129]; - pl[BLACK] = setupPosition[130]; + R = setupPosition[129]; } for(i=0; i<=U; i++) A[i].D = A[i].K = 0; // clear hash table for(nr=0; nr