From: Yann Dirson Date: Mon, 11 Feb 2008 00:47:00 +0000 (+0100) Subject: Document internal APIs. X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7f6340bb48dec4e1e091fcf551af50bd3cfdcd2e;p=gnushogi.git Document internal APIs. --- diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 56afbe6..785b72e 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -125,6 +125,17 @@ movealgbr(short m, char *s) /* * Generate move strings in different formats. + * + * INPUT: + * - f piece to be moved + * - 0 < f < NO_SQUARES source square + * - NO_SQUARES <= f NO_SQUARES + 2*NO_PIECES dropped piece modulo NO_PIECES + * - t & 0x7f target square + * - t & 0x80 promotion flag + * - flag FIXME: must be zero ? + * + * OUTPUT: + * - GLOBAL mvstr */ void diff --git a/gnushogi/gnushogi.h b/gnushogi/gnushogi.h index 71a4e3f..78f03fa 100644 --- a/gnushogi/gnushogi.h +++ b/gnushogi/gnushogi.h @@ -250,6 +250,7 @@ enum { king }; +/* move types */ enum { ptype_no_piece = 0, ptype_pawn = 0, diff --git a/gnushogi/init.c b/gnushogi/init.c index 4756d39..ed52724 100644 --- a/gnushogi/init.c +++ b/gnushogi/init.c @@ -310,12 +310,12 @@ Initialize_dist(void) /* - * nextpos[piece][from-square], nextdir[piece][from-square] gives vector - * of positions reachable from from-square in ppos with piece such that the + * nextpos[ptype][from-square], nextdir[ptype][from-square] gives vector + * of positions reachable from from-square in ppos with ptype such that the * sequence * - * ppos = nextpos[piece][from-square]; - * pdir = nextdir[piece][from-square]; + * ppos = nextpos[ptype][from-square]; + * pdir = nextdir[ptype][from-square]; * u = ppos[sq]; * * do @@ -514,6 +514,9 @@ Initialize_moves(void) short steps[8]; short fpo = inunmap[0], tpo = 1 + inunmap[NO_SQUARES-1]; + /* pre-fill nextpos and nextdir with source position, probably so + * (color[u] == neutral) stops to match once all moves have been seen + */ for (ptyp = 0; ptyp < NO_PTYPE_PIECES; ptyp++) { for (po = 0; po < NO_SQUARES; po++)