--- /dev/null
+Generic cleanups
+
+- hunt for more hardcoded variant-specific constants
+ - position of captured pieces in curses mode
+ - compile with bound-checker
+- add autosave mode to ease hunt for segfaults ?
+- generate patterns.inc at build-time
+- use 2D array for the board, get rid of the (i)nunmap stuff
+- fixup build procedure to support parallel make runs
+- investigate those preexisting "overflow in implicit constant
+ conversion" warnings
+
+Minishogi-related stuff
+
+- make minishogi a run-time option rather than a compile-time one
+- minishogi patterns
+- tune difficulty levels
+- other tunings to investigate
+ * PromotionZoneDistanceBonus
+ * OPENING_HINT
+- add minishogi stuff to the doc
+- use valid minishogi moves in online help
+
+- segfault (on level 1) following 2e1d 1d4a
+ => field.piece can reach 14 in pattern.c::update_advance_bonus
+ => probably related to using patterns for standard shogi
+ => must break the circular pattern.o <-> pattern.inc dep to
+ be able to generated pattern.inc as needed
}
while (u != square);
+#ifndef MINISHOGI
/* try a knight capture (using xside's knight moves) */
ptyp = ptype[side ^ 1][knight];
#endif
}
while (u != square);
+#endif /* MINISHOGI */
*blockable = true;
}
while (u != square);
+#ifndef MINISHOGI
/* try a lance capture (using xside's lance moves) */
ptyp = ptype[side ^ 1][lance];
}
}
while (u != square);
+#endif /* MINISHOGI */
return false;
}
skipb();
Captured[side][pawn] = atoi(InPtr);
skip();
+#ifndef MINISHOGI
Captured[side][lance] = atoi(InPtr);
skip();
Captured[side][knight] = atoi(InPtr);
skip();
+#endif
Captured[side][silver] = atoi(InPtr);
skip();
Captured[side][gold] = atoi(InPtr);
}
fputs(empty, fd);
- fprintf(fd, " 9 8 7 6 5 4 3 2 1\n"); /* FIXME */
+#ifndef MINISHOGI
+ fprintf(fd, " 9 8 7 6 5 4 3 2 1\n");
fputs(empty, fd);
fprintf(fd, " p l n s g b r k\n");
+#else
+ fprintf(fd, " 5 4 3 2 1\n");
+ fputs(empty, fd);
+ fprintf(fd, " p s g b r k\n");
+#endif
for (side = 0; side <= 1; side++)
{
fprintf(fd, "%c", (side == black) ? 'B' : 'W');
fprintf(fd, " %2d", Captured[side][pawn]);
+#ifndef MINISHOGI
fprintf(fd, " %2d", Captured[side][lance]);
fprintf(fd, " %2d", Captured[side][knight]);
+#endif
fprintf(fd, " %2d", Captured[side][silver]);
fprintf(fd, " %2d", Captured[side][gold]);
fprintf(fd, " %2d", Captured[side][bishop]);
InPtr = fname;
Captured[side][pawn] = atoi(InPtr);
skip();
+#ifndef MINISHOGI
Captured[side][lance] = atoi(InPtr);
skip();
Captured[side][knight] = atoi(InPtr);
skip();
+#endif
Captured[side][silver] = atoi(InPtr);
skip();
Captured[side][gold] = atoi(InPtr);
for (side = 0; side <= 1; side++)
{
- sprintf(fname, "%d %d %d %d %d %d %d %d\n",
+ sprintf(fname,
+#ifndef MINISHOGI
+ "%d %d %d %d %d %d %d %d\n",
+#else
+ "%d %d %d %d %d %d\n",
+#endif
Captured[side][pawn],
+#ifndef MINISHOGI
Captured[side][lance],
Captured[side][knight],
+#endif
Captured[side][silver],
Captured[side][gold],
Captured[side][bishop],
gotoXY(3, 4 + 2*NO_ROWS);
printw(" ");
+#ifndef MINISHOGI
if (flag.reverse)
printw(" 1 2 3 4 5 6 7 8 9");
else
printw(" 9 8 7 6 5 4 3 2 1");
+#else
+ if (flag.reverse)
+ printw(" 1 2 3 4 5");
+ else
+ printw(" 1 2 3 4 5");
+#endif
for (sq = 0; sq < NO_SQUARES; sq++)
DrawPiece(sq);
/* Pieces and colors of initial board setup */
+#ifndef MINISHOGI
const small_short Stboard[NO_SQUARES] =
{
lance, knight, silver, gold, king, gold, silver, knight, lance,
white, white, white, white,
white, white, white, white, white
};
+#else
+const small_short Stboard[NO_SQUARES] =
+{
+ king, gold, silver, bishop, rook,
+ pawn, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, pawn,
+ rook, bishop, silver, gold, king,
+};
+const small_short Stcolor[NO_SQUARES] =
+{
+ black, black, black, black, black,
+ black, neutral, neutral, neutral, neutral,
+ neutral, neutral, neutral, neutral, neutral,
+ neutral, neutral, neutral, neutral, white,
+ white, white, white, white, white
+};
+#endif
+
/* Actual pieces and colors */
small_short board[NO_SQUARES], color[NO_SQUARES];
{ 0, 35, 70, 99 }, /* main stage borders */
/* ------------------------------------------ */
{ 7, 7, 8, 10 }, /* Pawn */
+#ifndef MINISHOGI
{ 20, 35, 45, 60 }, /* Lance */
{ 20, 35, 45, 60 }, /* Knight */
+#endif
{ 35, 40, 60, 80 }, /* Silver */
{ 35, 50, 65, 80 }, /* Gold */
{ 90, 90, 90, 90 }, /* Bishop */
{ 95, 95, 95, 95 }, /* Rook */
{ 15, 25, 40, 65 }, /* promoted Pawn */
+#ifndef MINISHOGI
{ 25, 45, 55, 65 }, /* promoted Lance */
{ 25, 45, 55, 65 }, /* promoted Knight */
+#endif
{ 35, 55, 75, 75 }, /* promoted Silver */
{ 99, 99, 99, 99 }, /* promoted Bishop */
{ 97, 97, 99, 99 }, /* promoted Rook */
{ 0, 5, 2, 1, 0, -1, -2, -3, -4, -5 };
/* distance to promotion zone */
+#ifndef MINISHOGI
static const int PromotionZoneDistanceBonus[NO_ROWS] =
{ 0, 0, 0, 0, 2, 6, 6, 8, 8 };
+#else
+static const int PromotionZoneDistanceBonus[NO_ROWS] =
+{ 0, 0, 2, 6, 8 }; /* FIXME ? */
+#endif
#define MAX_BMBLTY 20
#define MAX_RMBLTY 20
static const short RMBLTY[MAX_RMBLTY] =
{ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 16, 16, 16, 16 };
+#ifndef MINISHOGI
/* Lance mobility bonus indexed by # reachable squares */
static const short LMBLTY[MAX_LMBLTY] =
{ 0, 0, 0, 0, 4, 6, 8, 10 };
+#endif
static const short MBLTY[NO_PIECES] =
-{ 0, 2, 1, 10, 5, 5, 1, 1, 5, 5, 5, 5, 1, 1, 4 };
+{ 0, 2,
+#ifndef MINISHOGI
+ 1, 10,
+#endif
+ 5, 5, 1, 1, 5,
+#ifndef MINISHOGI
+ 5, 5,
+#endif
+ 5, 1, 1, 4 };
static const short KTHRT[36] =
{ 0, -8, -20, -36, -52, -68, -80, -80, -80, -80, -80, -80,
static small_short Msilver[2][NO_SQUARES];
static small_short Mgold [2][NO_SQUARES];
static small_short Mking [2][NO_SQUARES];
+#ifndef MINISHOGI
static small_short Mlance [2][NO_SQUARES];
static small_short Mknight[2][NO_SQUARES];
+#endif
static small_short Mbishop[2][NO_SQUARES];
static small_short Mrook [2][NO_SQUARES];
-static Mpiece_array Mpawn, Mlance, Mknight, Msilver, Mgold,
- Mbishop, Mrook, Mking;
+static Mpiece_array Mpawn,
+#ifndef MINISHOGI
+ Mlance, Mknight,
+#endif
+ Msilver, Mgold, Mbishop, Mrook, Mking;
Mpiece_array *Mpiece[NO_PIECES] =
-{ NULL, &Mpawn, &Mlance, &Mknight, &Msilver, &Mgold, &Mbishop, &Mrook,
- &Mgold, &Mgold, &Mgold, &Mgold, &Mbishop, &Mrook, &Mking };
+{ NULL, &Mpawn,
+#ifndef MINISHOGI
+ &Mlance, &Mknight,
+#endif
+ &Msilver, &Mgold, &Mbishop, &Mrook,
+ &Mgold,
+#ifndef MINISHOGI
+ &Mgold, &Mgold,
+#endif
+ &Mgold, &Mbishop, &Mrook, &Mking };
static short c1, c2;
add_target(sq, side, 11);
break;
+#ifndef MINISHOGI
case knight: /* vertically ahead if advanced */
/* FIXME: gotta love them magic numbers... */
if ((sq != 1) && (sq != 7) && (sq != 73) && (sq != 79))
add_target(sq, side, 11);
break;
+#endif
}
}
/* it's the first piece in the current direction */
if (color[u] == c1)
{
+#ifndef MINISHOGI
/* own intercepting piece in x-ray attack */
if (upiece == lance)
{
}
}
else
+#endif
{
/* bishop or rook x-ray */
if ((upiece == bishop) && (board[u] == pawn)
{
s += (ds = -2*fv1[HCLSD]);
}
+#ifndef MINISHOGI
else if ((upiece == rook) && (board[u] == lance)
&& (GameType[c1] == STATIC_ROOK)
&& (column(u) == csq))
{
s += (ds = fv1[XRAY]);
}
+#endif
}
}
else
{
/* enemy's intercepting piece in pin attack */
+#ifndef MINISHOGI
if (upiece == lance)
{
/* lance pin attack */
}
}
else
+#endif
{
/* bishop or rook pin attack */
if (board[u] == pawn)
}
else
{
+#ifndef MINISHOGI
if (upiece == lance)
{
s += (ds = fv1[XRAY] / 2);
}
else
+#endif
{
s += (ds = fv1[XRAY]);
}
}
-
+#ifndef MINISHOGI
/*
* Calculate the positional value for a lance on 'sq'.
*/
return s;
}
+#endif
+#ifndef MINISHOGI
/*
* Calculate the positional value for a promoted lance on 'sq'.
*/
return s;
}
+#endif
s += (ds = BMBLTY[mob] * fv1[MOBILITY] / 100);
else if ((piece == rook) || (piece == prook))
s += (ds = RMBLTY[mob] * fv1[MOBILITY] / 100);
+#ifndef MINISHOGI
else
s += (ds = LMBLTY[mob] * fv1[MOBILITY] / 100);
+#endif
}
else
{
s += PawnValue(sq, side);
break;
+#ifndef MINISHOGI
case lance:
s += LanceValue(sq, side);
break;
case knight:
s += KnightValue(sq, side);
break;
+#endif
case silver:
s += SilverValue(sq, side);
s += PPawnValue(sq, side);
break;
+#ifndef MINISHOGI
case plance:
s += PLanceValue(sq, side);
break;
case pknight:
s += PKnightValue(sq, side);
break;
+#endif
case psilver:
s += PSilverValue(sq, side);
if ((m = seed[c1]))
{
- for (piece = lance, n = 0; piece <= rook; piece++)
+ for (piece = pawn+1, n = 0; piece <= rook; piece++)
{
if (Captured[c1][piece])
n++;
ds = RMBLTY[MAX_RMBLTY - 1];
break;
+#ifndef MINISHOGI
case lance:
ds = LMBLTY[MAX_LMBLTY - 1];
break;
+#endif
default:
ds = MBLTY[piece];
GuessGameType(side_to_move);
array_zero(Mpawn, sizeof(Mpawn));
+#ifndef MINISHOGI
array_zero(Mlance, sizeof(Mlance));
array_zero(Mknight, sizeof(Mknight));
+#endif
array_zero(Msilver, sizeof(Msilver));
array_zero(Mgold, sizeof(Mgold));
array_zero(Mbishop, sizeof(Mbishop));
stage = 30;
}
+#ifndef MINISHOGI
/* Update stage depending on board features and attack balance value */
if (abs(ds = (mtl[side] - mtl[xside]))
stage += (ds = db1);
}
+#endif
for (c1 = black, c2 = white; c1 <= white; c1++, c2--)
{
/* Determine stage dependant weights */
ADVNCM[pawn] = 1; /* advanced pawn bonus increment */
+#ifndef MINISHOGI
ADVNCM[lance] = 1;
ADVNCM[knight] = 1;
+#endif
ADVNCM[silver] = 1; /* advanced silver bonus increment */
ADVNCM[gold] = 1; /* advanced gold bonus increment */
ADVNCM[bishop] = 1;
switch (p)
{
case pawn:
+#ifndef MINISHOGI
case lance:
case knight:
+#endif
case silver:
case bishop:
case rook:
: (generate_move_flags ? ILLEGAL_TRAPPED : false));
}
+#ifndef MINISHOGI
case lance:
if (color == black)
{
? true
: (generate_move_flags ? ILLEGAL_TRAPPED : false));
}
+#endif
}
return true;
/* CHECKME: is this right? */
if (((rvupiece == rvuboard) && (upiece == pawn))
- || (upiece == bishop) || (upiece == knight))
+ || (upiece == bishop)
+#ifndef MINISHOGI
+ || (upiece == knight)
+#endif
+ )
{
s++; /* The opposing pawn (piece) */
{
#ifdef TESUJIBONUS
/* Look at non-promoting silver or knight */
- if (piece == silver || piece == knight)
+ if (piece == silver
+#ifndef MINISHOGI
+ || piece == knight
+#endif
+ )
{
local_flag |= tesuji; /* Non-promotion */
s++;
GenUnmakeMove(side, f, sq, tempb, tempc, false);
}
}
+#ifndef MINISHOGI
else if (piece == lance)
{
if ((side == black) && (r == 8))
else if ((side == white) && (r <= 1))
possible = (generate_move_flags ? ILLEGAL_TRAPPED : false);
}
+#endif
return possible;
}
if (board[square = PieceList[side][0]] != king)
return;
- for (piece = lance; piece <= rook; piece++) /* FIXME */
+ for (piece = pawn+1; piece <= rook; piece++)
{
- if (piece == lance || piece == bishop || piece == rook)
+ if (
+#ifndef MINISHOGI
+ piece == lance ||
+#endif
+ piece == bishop || piece == rook)
{
/* check for threat of xside piece */
ptyp = ptype[side][piece];
* Drops are restricted for pawns, lances, and knights.
*/
- if (piece > knight)
+ if (piece >= silver)
break;
}
}
{ 4, 76, 0 };
const small_short relative_value[NO_PIECES] =
-{ 0, 1, 3, 4, 7, 9, 10, 12,
- 2, 5, 6, 8, 11, 13, 14 };
+{ 0, 1,
+#ifndef MINISHOGI
+ 3, 4,
+#endif
+ 7, 9, 10, 12,
+ 2,
+#ifndef MINISHOGI
+ 5, 6,
+#endif
+8, 11, 13, 14 };
const long control[NO_PIECES] =
-{ 0, ctlP, ctlL, ctlN, ctlS, ctlG, ctlB, ctlR,
- ctlPp, ctlLp, ctlNp, ctlSp, ctlBp, ctlRp, ctlK };
+{ 0, ctlP,
+#ifndef MINISHOGI
+ ctlL, ctlN,
+#endif
+ ctlS, ctlG, ctlB, ctlR,
+ ctlPp,
+#ifndef MINISHOGI
+ ctlLp, ctlNp,
+#endif
+ ctlSp, ctlBp, ctlRp, ctlK };
short stage, stage2;
short balance[2];
#define SEEK_SET 0
#define SEEK_END 2
+#ifdef MINISHOGI
+#define NO_PIECES 11
+#define MAX_CAPTURED 19
+#define NO_PTYPE_PIECES 11
+#define NO_COLS 5
+#define NO_ROWS 5
+#else
#define NO_PIECES 15
#define MAX_CAPTURED 19
#define NO_PTYPE_PIECES 15
#define NO_COLS 9
#define NO_ROWS 9
+#endif
#define NO_SQUARES (NO_COLS*NO_ROWS)
#define ROW_NAME(n) ('a' + NO_ROWS - 1 - n)
/* board properties */
+#ifndef MINISHOGI
#define InBlackCamp(sq) ((sq) < 27)
#define InWhiteCamp(sq) ((sq) > 53)
+#else
+#define InBlackCamp(sq) ((sq) < 5)
+#define InWhiteCamp(sq) ((sq) > 19)
+#endif
#define InPromotionZone(side, sq) \
(((side) == black) ? InWhiteCamp(sq) : InBlackCamp(sq))
/* constants */
+/* FIXME ? */
#define OPENING_HINT 0x141d /* P7g-7f (20->29) */
/* truth values */
enum {
no_piece = 0,
pawn,
+#ifndef MINISHOGI
lance,
knight,
+#endif
+ /* start of pieces that can be dropped at any square */
silver,
gold,
bishop,
rook,
ppawn,
+#ifndef MINISHOGI
plance,
pknight,
+#endif
psilver,
pbishop,
prook,
enum {
ptype_no_piece = 0,
ptype_pawn = 0,
+#ifndef MINISHOGI
ptype_lance,
ptype_knight,
+#endif
ptype_silver,
ptype_gold,
ptype_bishop,
ptype_prook,
ptype_king,
ptype_wpawn,
+#ifndef MINISHOGI
ptype_wlance,
ptype_wknight,
+#endif
ptype_wsilver,
ptype_wgold
};
#endif
/* move symbols */
+#ifndef MINISHOGI
#define pxx (" PLNSGBRPLNSBRK ")
#define qxx (" plnsgbrplnsbrk ")
#define rxx ("ihgfedcba")
#define cxx ("987654321")
+#else
+#define pxx (" PSGBRPSBRK ")
+#define qxx (" psgbrpsbrk ")
+#define rxx ("edcba")
+#define cxx ("54321")
+#endif
/***************** Table limits ********************************************/
#define MAXDEPTH 40 /* max depth a search can be carried */
#define MINDEPTH 2 /* min search depth =1 (no hint), >1 hint */
#define MAXMOVES 300 /* max number of half moves in a game */
-#define CPSIZE 235 /* size of lang file max */
+#define CPSIZE 241 /* size of lang file max */
#if defined SMALL_MEMORY
# if defined SAVE_SSCORE
typedef small_short distdata_array[NO_SQUARES][NO_SQUARES];
extern const small_short inunmap[NO_SQUARES];
+#ifndef MINISHOGI
extern const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 4)];
+#else
+extern const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 2)];
+#endif
#if defined SAVE_NEXTPOS
extern const small_short direc[NO_PTYPE_PIECES][8];
const small_short piece_of_ptype[NO_PTYPE_PIECES] =
{
- pawn, lance, knight, silver, gold, bishop, rook, pbishop, prook, king,
- pawn, lance, knight, silver, gold
+ pawn,
+#ifndef MINISHOGI
+ lance, knight,
+#endif
+ silver, gold, bishop, rook, pbishop, prook, king,
+ pawn,
+#ifndef MINISHOGI
+ lance, knight,
+#endif
+ silver, gold
};
+/* FIXME: all bishops and rooks are black ? */
const small_short side_of_ptype[NO_PTYPE_PIECES] =
{
- black, black, black, black, black, black, black, black, black, black,
- white, white, white, white, white
+ black,
+#ifndef MINISHOGI
+ black, black,
+#endif
+ black, black, black, black, black, black, black,
+ white,
+#ifndef MINISHOGI
+ white, white,
+#endif
+ white, white
};
#ifdef SAVE_NEXTPOS
const small_short sweep[NO_PIECES] =
{
- false, false, true, false, false, false, true, true,
- false, false, false, false, true, true, false
+ false, false,
+#ifndef MINISHOGI
+ true, false,
+#endif
+ false, false, true, true,
+ false,
+#ifndef MINISHOGI
+ false, false,
+#endif
+ false, true, true, false
};
else
return drow;
+#ifndef MINISHOGI
case lance:
if ((dcol != 0) || (drow < 1))
return CANNOT_REACH;
return CANNOT_REACH;
else
return (drow / 2);
+#endif
case silver:
if (drow > 0)
case gold:
case ppawn:
+#ifndef MINISHOGI
case pknight:
case plance:
+#endif
case psilver:
if (abs(dcol) == 0)
return (abs(drow));
const small_short ptype[2][NO_PIECES] =
{
{
- ptype_no_piece, ptype_pawn, ptype_lance, ptype_knight,
+ ptype_no_piece, ptype_pawn,
+#ifndef MINISHOGI
+ ptype_lance, ptype_knight,
+#endif
ptype_silver, ptype_gold, ptype_bishop, ptype_rook,
- ptype_gold, ptype_gold, ptype_gold, ptype_gold,
+ ptype_gold,
+#ifndef MINISHOGI
+ ptype_gold, ptype_gold,
+#endif
+ ptype_gold,
ptype_pbishop, ptype_prook, ptype_king
},
{
- ptype_no_piece, ptype_wpawn, ptype_wlance, ptype_wknight,
+ ptype_no_piece, ptype_wpawn,
+#ifndef MINISHOGI
+ ptype_wlance, ptype_wknight,
+#endif
ptype_wsilver, ptype_wgold, ptype_bishop, ptype_rook,
- ptype_wgold, ptype_wgold, ptype_wgold, ptype_wgold,
+ ptype_wgold,
+#ifndef MINISHOGI
+ ptype_wgold, ptype_wgold,
+#endif
+ ptype_wgold,
ptype_pbishop, ptype_prook, ptype_king
},
};
const small_short promoted[NO_PIECES] =
{
- no_piece, ppawn, plance, pknight, psilver, gold, pbishop, prook,
- ppawn, plance, pknight, psilver, pbishop, prook, king
+ no_piece, ppawn,
+#ifndef MINISHOGI
+ plance, pknight,
+#endif
+ psilver, gold, pbishop, prook,
+ ppawn,
+#ifndef MINISHOGI
+ plance, pknight,
+#endif
+ psilver, pbishop, prook, king
};
const small_short unpromoted[NO_PIECES] =
{
- no_piece, pawn, lance, knight, silver, gold, bishop, rook,
- pawn, lance, knight, silver, bishop, rook, king
+ no_piece, pawn,
+#ifndef MINISHOGI
+ lance, knight,
+#endif
+ silver, gold, bishop, rook,
+ pawn,
+#ifndef MINISHOGI
+ lance, knight,
+#endif
+ silver, bishop, rook, king
};
const small_short is_promoted[NO_PIECES] =
{
- false, false, false, false, false, false, false, false,
- true, true, true, true, true, true, false
+ false, false,
+#ifndef MINISHOGI
+ false, false,
+#endif
+ false, false, false, false,
+ true,
+#ifndef MINISHOGI
+ true, true,
+#endif
+ true, true, true, false
};
/* data used to generate nextpos/nextdir */
+#ifndef MINISHOGI
+/* FIXME: use predefined constants ! */
#if !defined SAVE_NEXTPOS
static
#endif
{ -11, 0, 0, 0, 0, 0, 0, 0 }, /* 11 ptype_wlance */
{ -21, -23, 0, 0, 0, 0, 0, 0 }, /* 12 ptype_wknight */
{ -10, -11, -12, 12, 10, 0, 0, 0 }, /* 13 ptype_wsilver */
- { -10, -11, -12, 1, -1, 11, 0, 0 }
-}; /* 14 ptype_wgold */
+ { -10, -11, -12, 1, -1, 11, 0, 0 } /* 14 ptype_wgold */
+};
+#else
+#if !defined SAVE_NEXTPOS
+static
+#endif
+const small_short direc[NO_PTYPE_PIECES][8] =
+{
+ { 7, 0, 0, 0, 0, 0, 0, 0 }, /* 0 ptype_pawn */
+ { 6, 7, 8, -8, -6, 0, 0, 0 }, /* 3 ptype_silver */
+ { 6, 7, 8, -1, 1, -7, 0, 0 }, /* 4 ptype_gold */
+ { 6, 8, -8, -6, 0, 0, 0, 0 }, /* 5 ptype_bishop */
+ { 7, -1, 1, -7, 0, 0, 0, 0 }, /* 6 ptype_rook */
+ { 6, 8, -8, -6, 7, -1, 1, -7 }, /* 7 ptype_pbishop */
+ { 7, -1, 1, -7, 6, 8, -8, -6 }, /* 8 ptype_prook */
+ { 6, 7, 8, -1, 1, -8, -7, -6 }, /* 9 ptype_king */
+ { -7, 0, 0, 0, 0, 0, 0, 0 }, /* 10 ptype_wpawn */
+ { -6, -7, -8, 8, 6, 0, 0, 0 }, /* 13 ptype_wsilver */
+ { -6, -7, -8, 1, -1, 7, 0, 0 } /* 14 ptype_wgold */
+};
+#endif
small_short diagonal(short d)
}
+#ifndef MINISHOGI
+/* FIXME */
static const small_short max_steps[NO_PTYPE_PIECES] =
{
1, 8, 1, 1, 1, 8, 8, 8, 8, 1, 1, 8, 1, 1, 1
};
+#else
+static const small_short max_steps[NO_PTYPE_PIECES] =
+{
+ 1, 1, 1, 4, 4, 4, 4, 1, 1, 1, 1
+};
+#endif
-
+#ifndef MINISHOGI
const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 4)] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
100, 101, 102, 103, 104, 105, 106, 107, 108,
111, 112, 113, 114, 115, 116, 117, 118, 119
};
+#else
+const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 2)] =
+{
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, 0, 1, 2, 3, 4, -1,
+ -1, 5, 6, 7, 8, 9, -1,
+ -1, 10, 11, 12, 13, 14, -1,
+ -1, 15, 16, 17, 18, 19, -1,
+ -1, 20, 21, 22, 23, 24, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+};
+const small_short inunmap[NO_SQUARES] =
+{
+ 8, 9, 10, 11, 12,
+ 15, 16, 17, 18, 19,
+ 22, 23, 24, 25, 26,
+ 29, 30, 31, 32, 33,
+ 36, 37, 38, 39, 40,
+};
+#endif
+
int InitFlag = false;