static
int
-Vparse (FILE * fd, USHORT *mv, USHORT *flags, USHORT side, int moveno)
+Vparse (FILE * fd, USHORT *mv, USHORT *flags, int moveno)
{
int c, i;
char s[255];
{
short i;
int mustwrite = false, first;
- unsigned short xside, side;
+ unsigned short side;
short c;
USHORT mv, flags;
unsigned int x;
{
/* setvbuf(fd, buffr, _IOFBF, 2048); */
side = black;
- xside = white;
hashbd = hashkey = 0;
i = 0;
- while ((c = Vparse(fd, &mv, &flags, side, i)) >= 0)
+ while ((c = Vparse(fd, &mv, &flags, i)) >= 0)
{
if (c == 1)
{
computer = opponent;
opponent = computer ^ 1;
- xside = side;
side = side ^ 1;
}
else if (i > 0)
RESET();
i = 0;
side = black;
- xside = white;
-
}
}
}
- sprintf(msg, "Book used %d(%d).", B.bookcount, B.booksize);
+ sprintf(msg, "Book used %lu(%lu).", B.bookcount, B.booksize);
dsp->ShowMessage(msg);
}
/*
- * OpeningBook(hint, side)
+ * OpeningBook(hint)
*
* Go through each of the opening lines of play and check for a match with
* the current game listing. If a match occurs, generate a random
*/
int
-OpeningBook(unsigned short *hint, short side)
+OpeningBook(unsigned short *hint)
{
unsigned short r, m;
int possibles = TrPnt[2] - TrPnt[1];
static int
-parser(char *f, int side, short *fpiece)
+parser(char *f, short *fpiece)
{
int c1, r1, c2, r2;
short i, p = false;
InPtr = fname;
skipb();
g = &GameList[GameCnt];
- g->gmove = parser(InPtr, side, &g->fpiece);
+ g->gmove = parser(InPtr, &g->fpiece);
skip();
g->score = atoi(InPtr);
skip();
void
TestPSpeed(short(*f) (short side), unsigned j)
{
- short i;
+ unsigned i;
long cnt, t1, t2;
#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
if (*time == ':')
{
time++;
+ /* FIXME: sec is parsed but ignored */
sec = (int)strtol(time, &time, 10);
}
if (*time == ':')
{
time++;
+ /* FIXME: sec is parsed but ignored */
sec = (int)strtol(time, &time, 10);
}
#include <ctype.h>
#include <signal.h>
#include <stdio.h>
+#include <stdarg.h>
#include <sys/param.h>
#include <sys/types.h>
static void ShowScore(short score);
void Curses_UpdateDisplay(short f, short t, short redraw, short isspec);
void Curses_Die(int sig);
+void Curses_ShowSidetoMove(void);
/****************************************
* Trivial output functions.
}
-static void
-ClearMessage(void)
-{
- gotoXY(TAB, 6);
- ClearEoln();
-}
-
-
void
Curses_ShowCurrentMove(short pnt, short f, short t)
{
void
Curses_ShowPostnValue(short sq)
{
- short score;
-
gotoXY(4 + 5 * VIR_C(sq), 5 + 2 * (7 - VIR_R(sq))); /* CHECKME */
- score = ScorePosition(color[sq]);
+ (void) ScorePosition(color[sq]);
if (color[sq] != neutral)
#if defined SAVE_SVALUE
static int
-AttackedPieceValue(short sq, short side)
+AttackedPieceValue(short sq)
{
- short s, ds;
+ short s;
s = 0;
- ds = -fv1[HUNGP] * 2;
hung[c1]++;
shung[sq]++;
*/
static inline int
-LanceValue(short sq, short side)
+LanceValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-KnightValue(short sq, short side)
+KnightValue(short sq)
{
short s = 0, ad;
short ds, checked_trapped = false;
*/
static inline int
-SilverValue(short sq, short side)
+SilverValue(short sq)
{
short s= 0, ds, ad;
*/
static inline int
-GoldValue(short sq, short side)
+GoldValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-BishopValue(short sq, short side)
+BishopValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-PPawnValue(short sq, short side)
+PPawnValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-PLanceValue(short sq, short side)
+PLanceValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-PKnightValue(short sq, short side)
+PKnightValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-PSilverValue(short sq, short side)
+PSilverValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-PBishopValue(short sq, short side)
+PBishopValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-PRookValue(short sq, short side)
+PRookValue(short sq)
{
short s = 0, ds, ad;
*/
static inline int
-KingValue(short sq, short side)
+KingValue(short sq)
{
short s = 0, ds;
if (a1 == 0)
{
/* undefended piece */
- s += AttackedPieceValue(sq, side);
+ s += AttackedPieceValue(sq);
}
else
{
if (attack_value < piece_value)
{
/* attacked by a weaker piece */
- s += AttackedPieceValue(sq, side) / 2;
+ s += AttackedPieceValue(sq) / 2;
}
else if (abs(attack_value - piece_value) < 10)
{
#ifndef MINISHOGI
case lance:
- s += LanceValue(sq, side);
+ s += LanceValue(sq);
break;
case knight:
- s += KnightValue(sq, side);
+ s += KnightValue(sq);
break;
#endif
case silver:
- s += SilverValue(sq, side);
+ s += SilverValue(sq);
break;
case gold:
- s += GoldValue(sq, side);
+ s += GoldValue(sq);
break;
case bishop:
- s += BishopValue(sq, side);
+ s += BishopValue(sq);
break;
case rook:
break;
case king:
- s += KingValue(sq, side);
+ s += KingValue(sq);
break;
case ppawn:
- s += PPawnValue(sq, side);
+ s += PPawnValue(sq);
break;
#ifndef MINISHOGI
case plance:
- s += PLanceValue(sq, side);
+ s += PLanceValue(sq);
break;
case pknight:
- s += PKnightValue(sq, side);
+ s += PKnightValue(sq);
break;
#endif
case psilver:
- s += PSilverValue(sq, side);
+ s += PSilverValue(sq);
break;
case pbishop:
- s += PBishopValue(sq, side);
+ s += PBishopValue(sq);
break;
case prook:
- s += PRookValue(sq, side);
+ s += PRookValue(sq);
break;
}
void
UpdateWeights(short stage)
{
+ /* FIXME: this was emptied between 1.1p02 ans 1.2p03, do we keep it ? */
}
inline static void
-Link(short side, short piece,
+Link(short side,
short from, short to, unsigned short local_flag, short s)
{
if (*TrP == TREE)
}
-inline int
-NonPromotionPossible(short color, short f,
+static inline int
+NonPromotionPossible(short color,
short t, short p)
{
switch (p)
/* bonus for possible next moves */
inline static short
-field_bonus(short ply, short side, short piece,
+field_bonus(short side, short piece,
short f, short t, unsigned short *local_flag)
{
short s, u, ptyp;
if (score_if_impossible < 0)
{
/* The move is flagged as illegal. */
- Link(side, piece,
+ Link(side,
f, t, local_flag, score_if_impossible);
return;
s -= 16 / Captured[side][silver];
#if defined DROPBONUS
- s += field_bonus(ply, side, piece, f, t, &local_flag);
+ s += field_bonus(side, piece, f, t, &local_flag);
if (s == 10 && piece != pawn)
local_flag |= questionable;
else
{
#if defined FIELDBONUS
- s += field_bonus(ply, side, piece, f, t, &local_flag);
+ s += field_bonus(side, piece, f, t, &local_flag);
#endif
}
}
if (try_link || GenerateAllMoves)
{
- Link(side, piece, f, t, local_flag,
+ Link(side, f, t, local_flag,
s - ((SCORE_LIMIT + 1000) * 2));
}
LinkMove(ply, sq, u, local_flag | promote, xside, true);
if ((possible
- = NonPromotionPossible(color[sq], sq, u, piece)))
+ = NonPromotionPossible(color[sq], u, piece)))
{
LinkMove(ply, sq, u, local_flag, xside, possible);
}
if ((PP = PromotionPossible(color[sq], sq, u, piece)))
{
- Link(side, piece,
+ Link(side,
sq, u, capture | promote,
(*value)[stage][board[u]]
#if !defined SAVE_SVALUE
if (!PP || flag.tsume)
{
- Link(side, piece,
+ Link(side,
sq, u, capture,
(*value)[stage][board[u]]
#if !defined SAVE_SVALUE
extern void Initialize_dist(void); /* init.c */
extern void Initialize_eval(void); /* eval.c */
extern void NewGame(void);
-extern int parse(FILE * fd, unsigned short *mv,
- short side, char *opening);
extern void GetOpenings(void);
-extern int OpeningBook(unsigned short *hint, short side);
+extern int OpeningBook(unsigned short *hint);
typedef enum
{
short score,
short depth,
short ply,
- short alpha,
short beta,
unsigned short mv);
}
}
- printf("The file contains %d entries out of max %d\n", nr[0], i);
+ printf("The file contains %d entries out of max %ld\n", nr[0], i);
for (j = 1; j < MAXDEPTH; j++)
printf("%d ", nr[j]);
#include <ctype.h>
#include <signal.h>
#include <stdarg.h>
+#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
"--------------------------------\n");
printf("Computer: %-12s Opponent: %s\n",
ColorStr[computer], ColorStr[opponent]);
- printf("Depth: %-12d Response time: %d sec\n",
+ printf("Depth: %-12d Response time: %ld sec\n",
MaxSearchDepth, MaxResponseTime/100);
printf("Random: %-12s Easy mode: %s\n",
(dither) ? "ON" : "OFF", (flag.easy) ? "ON" : "OFF");
(flag.beep) ? "ON" : "OFF", (flag.hash) ? "ON" : "OFF");
printf("Tsume: %-12s Force: %s\n",
(flag.tsume) ? "ON" : "OFF", (flag.force) ? "ON" : "OFF");
- printf("Time Control %s %d moves %d sec %d add %d depth\n",
+ printf("Time Control %s %d moves %ld sec %d add %d depth\n",
(TCflag) ? "ON" : "OFF",
TimeControl.moves[black], TimeControl.clock[black] / 100,
TCadd/100, MaxSearchDepth);
void
Raw_ShowPostnValue(short sq)
{
- short score;
- score = ScorePosition(color[sq]);
+ (void) ScorePosition(color[sq]);
if (color[sq] != neutral)
{
if (flag.regularstart && Book)
{
- flag.timeout = bookflag = OpeningBook(&hint, side);
+ flag.timeout = bookflag = OpeningBook(&hint);
if (TCflag)
ResponseTime += ResponseTime;
&& (ProbeFTable(side, depth, ply, &alpha, &beta, &score)
== true))
{
- PutInTTable(side, score, depth, ply, alpha, beta, PV);
+ PutInTTable(side, score, depth, ply, beta, PV);
bstline[ply] = PV;
bstline[ply + 1] = 0;
{
# ifdef HASHFILE /* MCV: warning: this confuses the formatter. */
if (use_ttable
- && PutInTTable(side, best, depth, ply, alpha, beta, mv)
+ && PutInTTable(side, best, depth, ply, beta, mv)
&& hashfile
&& (depth > HashDepth)
&& (GameCnt < HashMoveLimit))
# else
if (use_ttable
- && PutInTTable(side, best, depth, ply, alpha, beta, mv))
+ && PutInTTable(side, best, depth, ply, beta, mv))
# endif
{
PutInFTable(side, best, depth, ply,
/* Make or Unmake drop move. */
-void
-drop(short side, short piece, short f, short t, short iop)
+static void
+drop(short side, short piece, short t, short iop)
{
if (iop == 1)
{
*tempst = svalue[t];
#endif
- (void)drop(side, g->fpiece, f, t, 1);
+ (void)drop(side, g->fpiece, t, 1);
}
else
{
if (node->flags & dropmask)
{
- (void)drop(side, (node->flags & pmask), f, t, 2);
+ (void)drop(side, (node->flags & pmask), t, 2);
#if !defined SAVE_SVALUE
svalue[t] = *tempst;
short recycle;
short ISZERO = 1;
-
+#if 0
int
-parse(FILE * fd, unsigned short *mv, short side, char *opening)
+parse(FILE * fd, unsigned short *mv, char *opening)
{
int c, i, r1, r2, c1, c2;
char s[128];
return 1;
}
-
+#endif
/*
* The field of a hashtable is computed as follows:
short score,
short depth,
short ply,
- short alpha,
short beta,
unsigned short mv)
{