4 * Main header file for GNU Shogi.
6 * ----------------------------------------------------------------------
7 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
8 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
10 * GNU SHOGI is based on GNU CHESS
12 * Copyright (c) 1988, 1989, 1990 John Stanback
13 * Copyright (c) 1992 Free Software Foundation
15 * This file is part of GNU SHOGI.
17 * GNU Shogi is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 3 of the License,
20 * or (at your option) any later version.
22 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
23 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 * You should have received a copy of the GNU General Public License along
28 * with GNU Shogi; see the file COPYING. If not, see
29 * <http://www.gnu.org/licenses/>.
30 * ----------------------------------------------------------------------
34 /* Hack for anal-retentive ANSI-compliance if desired: */
37 /* FIXME: this file needs to be reorganized in some rational manner. */
42 #include "config.h" /* Portability #defines. */
44 #include "opts.h" /* Various option-setting #defines. */
57 extern display_t display_type;
59 #define XSHOGI (display_type == DISPLAY_X)
60 #define NOT_CURSES ((display_type == DISPLAY_X) \
61 || (display_type == DISPLAY_RAW))
64 /* Miscellaneous globals. */
66 extern short hard_time_limit; /* If you exceed time limit, you lose. */
67 extern short barebones; /* Don't print of stats for x interface. */
68 extern short nolist; /* Don't list game after exit. */
72 * Options for various compilers/OSs.
76 * type small_short must cover -128 .. 127. In case of trouble,
77 * try commenting out "signed". If this doesn't help, use short.
80 #define small_short signed char
81 #define small_ushort unsigned char
84 typedef small_short BYTE;
85 typedef small_ushort UBYTE;
87 typedef unsigned short USHORT;
89 typedef unsigned int UINT;
91 typedef unsigned long ULONG;
94 #if !defined(HAVE_MEMCPY) && !defined(HAVE_BCOPY)
95 # define array_copy(src, dst, len) \
98 char *psrc = (char *)src, *pdst = (char *)dst; \
99 for (i = len; i; pdst[--i] = psrc[i]); \
101 # define array_zero(dst, len) \
104 char *pdst = (char *)dst; \
105 for (i = len; i; pdst[--i] = 0); \
107 #elif !defined(HAVE_MEMCPY) /* BSD and derivatives */
108 # define array_copy(src, dst, len) bcopy(src, dst, len)
109 # define array_zero(dst, len) bzero(dst, len)
110 #else /* System V and derivatives */
111 # define array_copy(src, dst, len) memcpy(dst, src, len)
112 # define array_zero(dst, len) memset(dst, 0, len)
122 * Standard header files.
131 #include <sys/param.h>
132 #include <sys/types.h>
133 #include <sys/times.h>
134 #include <sys/ioctl.h>
137 #if TIME_WITH_SYS_TIME
138 # include <sys/time.h>
142 # include <sys/time.h>
151 extern char *binbookfile;
154 extern char *bookfile;
158 extern void movealgbr(short m, char *s);
165 #define MAX_CAPTURED 19
166 #define NO_PTYPE_PIECES 15
169 #define NO_SQUARES (NO_COLS*NO_ROWS)
171 #define ROW_NAME(n) ('a' + NO_ROWS - 1 - n)
172 #define COL_NAME(n) ('1' + NO_COLS - 1 - n)
174 #if defined HASHFILE || defined CACHE
175 # define PTBLBDSIZE (NO_SQUARES + NO_PIECES)
180 #define SCORE_LIMIT 12000
182 /* masks into upper 16 bits of attacks array */
183 /* observe order of relative piece values */
184 #define CNT_MASK 0x000000FF
185 #define ctlP 0x00200000
186 #define ctlPp 0x00100000
187 #define ctlL 0x00080000
188 #define ctlN 0x00040000
189 #define ctlLp 0x00020000
190 #define ctlNp 0x00010000
191 #define ctlS 0x00008000
192 #define ctlSp 0x00004000
193 #define ctlG 0x00002000
194 #define ctlB 0x00001000
195 #define ctlBp 0x00000800
196 #define ctlR 0x00000400
197 #define ctlRp 0x00000200
198 #define ctlK 0x00000100
200 /* attack functions */
201 #define Pattack(c, u) (attack[c][u] > ctlP)
202 #define Anyattack(c, u) (attack[c][u] != 0)
204 /* hashtable flags */
205 #define truescore 0x0001
206 #define lowerbound 0x0002
207 #define upperbound 0x0004
208 #define kingcastle 0x0008
209 #define queencastle 0x0010
210 #define evalflag 0x0020
213 #define BlackKing PieceList[black][0]
214 #define WhiteKing PieceList[white][0]
215 #define OwnKing PieceList[c1][0]
216 #define EnemyKing PieceList[c2][0]
219 /* board properties */
220 #define InBlackCamp(sq) ((sq) < 27)
221 #define InWhiteCamp(sq) ((sq) > 53)
222 #define InPromotionZone(side, sq) \
223 (((side) == black) ? InWhiteCamp(sq) : InBlackCamp(sq))
226 #define OPENING_HINT 0x141d /* P7g-7f (20->29) */
242 /* piece code defines */
282 #define pmask 0x000f /* 15 */
283 #define promote 0x0010 /* 16 */
284 #define dropmask 0x0020 /* 32 */
285 #define exact 0x0040 /* 64 */
286 #define tesuji 0x0080 /* 128 */
287 #define check 0x0100 /* 256 */
288 #define capture 0x0200 /* 512 */
289 #define draw 0x0400 /* 1024 */
290 #define stupid 0x0800 /* 2048 */
291 #define questionable 0x1000 /* 4096 */
292 #define kingattack 0x2000 /* 8192 */
293 #define book 0x4000 /* 16384 */
295 /* move quality flags */
296 #define goodmove tesuji
297 #define badmove stupid
299 #define difficult questionable
303 #define pxx (" PLNSGBRPLNSBRK ")
304 #define qxx (" plnsgbrplnsbrk ")
305 #define rxx ("ihgfedcba")
306 #define cxx ("987654321")
308 /***************** Table limits ********************************************/
311 * ttblsz must be a power of 2. Setting ttblsz 0 removes the transposition
317 #elif defined SMALL_MEMORY
318 # if defined SAVE_SSCORE
319 # define vttblsz (1 << 12)
321 # if defined EXTRA_2MB
322 # define vttblsz (1 << 12)
324 # define vttblsz (1 << 10)
328 # define vttblsz (100001)
331 #if defined SMALL_MEMORY
332 # define MINTTABLE (0)
334 # define MINTTABLE (8000) /* min ttable size -1 */
337 #define ttblsz vttblsz
339 #if defined SMALL_MEMORY
340 # if !defined SAVE_SSCORE
341 # define TREE 1500 /* max number of tree entries */
343 # define TREE 2500 /* max number of tree entries */
346 # define TREE 4000 /* max number of tree entries */
349 #define MAXDEPTH 40 /* max depth a search can be carried */
350 #define MINDEPTH 2 /* min search depth =1 (no hint), >1 hint */
351 #define MAXMOVES 300 /* max number of half moves in a game */
352 #define CPSIZE 235 /* size of lang file max */
354 #if defined SMALL_MEMORY
355 # if defined SAVE_SSCORE
356 # define ETABLE (1 << 10) /* static eval cache */
358 # if defined EXTRA_2MB
359 # define ETABLE (1 << 10) /* static eval cache */
361 # define ETABLE (1 << 8) /* static eval cache */
365 # define ETABLE (10001) /* static eval cache */
368 /***************** tuning paramaters *******************/
370 #if defined VERY_SLOW_CPU
371 # define MINRESPONSETIME 300
372 #elif defined SLOW_CPU
373 # define MINRESPONSETIME 200
375 # define MINRESPONSETIME 100 /* 1 s */
380 #define CHKDEPTH 1 /* always look forward CHKDEPTH
381 * half-moves if in check */
383 #if defined SLOW_CPU || defined VERY_SLOW_CPU
384 # define DEPTHBEYOND 7 /* Max to go beyond Sdepth */
386 # define DEPTHBEYOND 11 /* Max to go beyond Sdepth */
389 #define HASHDEPTH 4 /* depth above which to use HashFile */
390 #define HASHMOVELIMIT 40 /* Use HashFile only for this many moves */
391 #define PTVALUE 0 /* material value below which pawn threats at
393 #define ZDEPTH 3 /* depth beyond which to check
394 * ZDELTA for extra time */
395 #define ZDELTA 10 /* score delta per ply to cause
396 * extra time to be given */
399 /* about 1/2 second worth of nodes for your machine */
400 #if defined VERY_SLOW_CPU
401 /* check the time every ZNODES positions */
402 # define ZNODES (flag.tsume ? 20 : 50)
403 #elif defined SLOW_CPU
404 # define ZNODES (flag.tsume ? 40 : 100)
406 # define ZNODES (flag.tsume ? 400 : 1000)
409 #define MAXTCCOUNTX 10 /* max number of time clicks
410 * per search to complete ply */
411 #define MAXTCCOUNTR 4 /* max number of time clicks
412 * per search extensions*/
413 #define SCORESPLIM 8 /* Score space doesn't apply after this stage */
414 #define SDEPTHLIM (Sdepth + 1)
415 #define HISTORYLIM 4096 /* Max value of history killer */
418 # if defined SMALL_MEMORY
419 # define HISTORY_MASK 0x8000 /* mask to MSB of history index */
420 # define HISTORY_SIZE 0x10000 /* size of history table */
422 # define HISTORY_MASK (1 << 15) /* mask to MSB of history index */
423 # define HISTORY_SIZE (1 << 16) /* size of history table */
426 /* smaller history table, but dangerous because of collisions */
427 # define HISTORY_MASK 0x3fff /* mask to significant bits
428 * of history index */
429 # if defined SMALL_MEMORY
430 # define HISTORY_SIZE 0x4000 /* size of history table */
432 # define HISTORY_SIZE (1 << 14) /* size of history table */
436 #define sizeof_history (sizeof(unsigned short) * (size_t)HISTORY_SIZE)
439 /* Map from.to (8bit.8bit) to from.to (0.7bit.8bit) */
440 # define khmove(mv) (mv & 0x7fff)
441 # define hmove(mv) ((mv & 0x7fff) ^ 0x5555)
443 /* Map from.to (8bit.8bit) to from.to (00.7bit.7bit) */
444 /* Swap bits of ToSquare in case of promotions, hoping that
445 no catastrophic collision occurs. */
446 # define khmove(mv) (((mv & 0x7f00) >> 1) | \
447 ((mv & 0x0080) ? ((mv & 0x007f) ^ 0x007f) : (mv & 0x007f)))
448 # define hmove(mv) (khmove(mv) ^ 0x2aaa)
451 /* mask color to 15th bit */
453 # define hindex(c, mv) ((c ? HISTORY_MASK : 0) | hmove(mv))
455 /* for white, swap bits, hoping that no catastrophic collision occurs. */
456 # define hindex(c, mv) (c ? ((~hmove(mv)) & HISTORY_MASK) : hmove(mv))
459 #define EWNDW 10 /* Eval window to force position scoring at depth
460 * greater than (Sdepth + 2) */
461 #define WAWNDW 90 /* alpha window when computer black */
462 #define WBWNDW 90 /* beta window when computer black */
463 #define BAWNDW 90 /* alpha window when computer white */
464 #define BBWNDW 90 /* beta window when computer white */
465 #define BXWNDW 90 /* window to force position scoring at lower */
466 #define WXWNDW 90 /* window to force position scoring at lower */
468 #define DITHER 5 /* max amount random can alter a pos value */
469 #define LBONUS 1 /* points per stage value of L increases */
470 #define BBONUS 2 /* points per stage value of B increases */
471 #define RBONUS 2 /* points per stage value of R increases */
473 #define QUESTIONABLE (valueK) /* Penalty for questionable moves. */
479 #define STUPID (valueR << 1) /* Penalty for stupid moves. */
481 #define KINGPOSLIMIT (-1) /* King positional scoring limit */
482 #define KINGSAFETY 32
483 #define MAXrehash (7)
485 /******* parameters for Opening Book ****************/
487 #define BOOKSIZE 8000 /* Number of unique position/move
488 * combinations allowed */
489 #define BOOKMAXPLY 40 /* Max plys to keep in book database */
490 #define BOOKFAIL (BOOKMAXPLY / 2) /* if no book move found for BOOKFAIL
491 * turns stop using book */
492 #define BOOKPOCKET 64
493 #define BOOKRAND 1000 /* used to select an opening move
495 #define BOOKENDPCT 950 /* 5 % chance a BOOKEND will stop the book */
496 #define DONTUSE -32760 /* flag move as don't use */
497 #define ILLEGAL_TRAPPED -32761 /* flag move as illegal:
498 * no move from this square */
499 #define ILLEGAL_DOUBLED -32762 /* flag move as illegal:
500 * two pawns on one column */
501 #define ILLEGAL_MATE -32763 /* flag move as illegal:
502 * pawn drop with mate */
504 /*****************************************************/
508 unsigned long key, bd;
513 unsigned long hashbd;
515 unsigned char depth; /* unsigned char saves some space */
522 unsigned char bd[PTBLBDSIZE];
523 #endif /* HASHTEST */
526 #if defined HASHFILE || defined CACHE
529 unsigned long ehashbd;
531 #if !defined SAVE_SSCORE
532 short sscore[NO_SQUARES];
537 unsigned char bd[PTBLBDSIZE];
538 #endif /* CACHETEST */
542 extern short use_etable;
543 typedef struct etable etable_field[ETABLE];
544 extern etable_field *etab[2];
548 * CHECKME! Is this valid?
550 * persistent transposition table. By default, the size is (1 << vfilesz).
551 * If you change the size, be sure to run gnushogi -c [vfilesz]
552 * before anything else.
557 #if defined SMALL_MEMORY
565 unsigned char bd[PTBLBDSIZE];
566 unsigned char f, t, flags, depth, sh, sl;
569 #endif /* HASHFILE */
575 short score, reply, width;
577 unsigned short flags;
583 unsigned short gmove; /* this move */
584 short score; /* score after this move */
585 short depth; /* search depth this move */
586 long time; /* search time this move */
587 short fpiece; /* moved or dropped piece */
588 short piece; /* piece captured */
589 short color; /* color */
590 short flags; /* move flags capture, promote, castle */
591 short Game50; /* flag for repetition */
592 long nodes; /* nodes searched for this move */
593 unsigned long hashkey, hashbd; /* board key before this move */
597 struct TimeControlRec
606 short mate; /* the game is over */
607 short post; /* show principle variation */
608 short quit; /* quit/exit */
609 short regularstart; /* did the game start from standard
611 short reverse; /* reverse board display */
612 short bothsides; /* computer plays both sides */
613 short hash; /* enable/disable transposition table */
614 short force; /* enter moves */
615 short easy; /* disable thinking on opponents time */
616 short beep; /* enable/disable beep */
617 short timeout; /* time to make a move */
618 short musttimeout; /* time to make a move */
619 short back; /* time to make a move */
620 short rcptr; /* enable/disable recapture heuristics */
621 short rv; /* reverse video */
622 short stars; /* add stars to uxdsp screen */
623 short coords; /* add coords to visual screen */
625 short material; /* draw on lack of material */
626 short illegal; /* illegal position */
627 short onemove; /* timing is onemove */
628 short gamein; /* timing is gamein */
629 short tsume; /* first consider checks */
632 extern FILE *debugfile;
635 #define EVALFILE "/tmp/EVAL"
638 extern FILE *debug_eval_file;
639 extern short debug_moves;
643 extern short use_history;
644 extern unsigned short *history;
649 extern char ColorStr[2][10];
651 extern char mvstr[4][6];
652 extern unsigned short MV[MAXDEPTH];
654 extern int mycnt1, mycnt2;
656 extern struct leaf rootnode;
657 extern struct leaf *Tree;
658 extern struct leaf *root;
659 extern char savefile[], listfile[];
660 extern short TrPnt[];
661 extern small_short board[], color[];
662 extern const small_short sweep[NO_PIECES];
663 extern small_short PieceList[2][NO_SQUARES], PawnCnt[2][NO_COLS];
664 extern small_short Captured[2][NO_PIECES];
667 # define ClearCaptured() \
669 short piece, color; \
670 for (color = black; color <= white; color++) \
671 for (piece = 0; piece < NO_PIECES; piece++) \
672 Captured[color][piece] = 0; \
675 # define ClearCaptured() \
676 memset((char *)Captured, 0, (unsigned long)sizeof(Captured))
677 #endif /* HAVE_MEMSET */
679 extern small_short Mvboard[];
681 #if !defined SAVE_SVALUE
682 extern short svalue[NO_SQUARES];
685 extern short pscore[2]; /* eval.c */
686 extern int EADD; /* eval.c */
687 extern int EGET; /* eval.c */
688 extern struct flags flag;
689 extern short opponent, computer, INCscore;
690 extern short WAwindow, BAwindow, WBwindow, BBwindow;
691 extern short dither, player;
692 extern short xwndw, contempt;
693 extern long ResponseTime, ExtraTime, TCleft,
694 MaxResponseTime, et, et0, time0, ft;
697 #ifdef INTERRUPT_TEST
698 extern long itime0, it;
701 extern long reminus, replus;
702 extern long GenCnt, NodeCnt, ETnodes, EvalNodes, HashAdd, HashCnt,
703 HashCol, THashCol, FHashCnt, FHashAdd;
704 extern short HashDepth, HashMoveLimit;
705 extern struct GameRec *GameList;
706 extern short GameCnt, Game50;
707 extern short Sdepth, MaxSearchDepth;
709 extern struct TimeControlRec TimeControl;
711 extern short TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
712 extern int timecomp[MINGAMEIN], timeopp[MINGAMEIN];
713 extern int compptr, oppptr;
714 extern short XCmore, XCmoves[], XCminutes[], XCseconds[], XC;
715 extern const short otherside[];
716 extern const small_short Stboard[];
717 extern const small_short Stcolor[];
718 extern unsigned short hint;
720 extern short stage, stage2;
722 #define in_opening_stage (!flag.tsume && (stage < 33))
723 #define in_middlegame_stage (!flag.tsume && (stage >= 33) && (stage <= 66))
724 #define in_endgame_stage (flag.tsume || (stage > 66))
726 extern short ahead, hash;
727 extern short balance[2];
728 extern small_short ChkFlag[], CptrFlag[], TesujiFlag[];
729 extern short Pscore[], Tscore[];
730 extern /*unsigned*/ short rehash; /* -1 is used as a flag --tpm */
731 extern unsigned int ttbllimit;
732 extern unsigned int TTadd;
733 extern unsigned int ttblsize;
734 extern short mtl[], hung[];
735 extern small_short Pindex[];
736 extern small_short PieceCnt[];
737 extern short FROMsquare, TOsquare;
738 extern small_short HasPiece[2][NO_PIECES];
739 extern const short kingP[];
740 extern unsigned short killr0[], killr1[];
741 extern unsigned short killr2[], killr3[];
742 extern unsigned short PrVar[MAXDEPTH];
743 extern unsigned short PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;
744 extern short mtl[2], pmtl[2], hung[2];
745 extern const small_short relative_value[];
746 extern const long control[];
747 extern small_short diagonal(short delta);
748 extern const small_short promoted[NO_PIECES], unpromoted[NO_PIECES];
749 extern const small_short is_promoted[NO_PIECES];
751 typedef unsigned char next_array[NO_SQUARES][NO_SQUARES];
752 typedef small_short distdata_array[NO_SQUARES][NO_SQUARES];
754 extern const small_short inunmap[NO_SQUARES];
755 extern const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 4)];
757 #if defined SAVE_NEXTPOS
758 extern const small_short direc[NO_PTYPE_PIECES][8];
759 extern short first_direction(short ptyp, short *d, short sq);
760 extern short next_direction(short ptyp, short *d, short sq);
761 extern short next_position(short ptyp, short *d, short sq, short u);
763 extern short use_nextpos;
764 extern next_array *nextpos[NO_PTYPE_PIECES];
765 extern next_array *nextdir[NO_PTYPE_PIECES];
768 extern value_array *value;
769 extern fscore_array *fscore;
771 #ifndef SAVE_DISTDATA
772 extern short use_distdata;
773 extern distdata_array *distdata;
776 #ifndef SAVE_PTYPE_DISTDATA
777 extern short use_ptype_distdata;
778 extern distdata_array *ptype_distdata[NO_PTYPE_PIECES];
781 extern const small_short ptype[2][NO_PIECES];
783 extern long filesz, hashmask, hashbase;
784 extern FILE *hashfile;
785 extern unsigned int starttime;
788 typedef small_short Mpiece_array[2][NO_SQUARES];
789 extern Mpiece_array *Mpiece[NO_PIECES];
790 extern short ADVNCM[NO_PIECES];
792 #define computed_distance(a, b) \
793 ((abs(column(a) - column(b)) > abs(row(a) - row(b))) \
794 ? abs(column(a) - column(b)) : abs(row(a) - row(b)))
796 extern short distance(short a, short b);
797 extern short ptype_distance(short ptyp, short f, short t);
798 extern short piece_distance(short side, short piece, short f, short t);
805 #define STATIC_ROOK 'S'
806 #define RANGING_ROOK 'R'
808 extern char GameType[2];
809 void ShowGameType(void);
811 extern unsigned short bookmaxply;
812 extern unsigned int bookcount;
813 extern unsigned int booksize;
814 extern unsigned long hashkey, hashbd;
816 typedef struct hashval hashcode_array[2][NO_PIECES][NO_SQUARES];
817 typedef struct hashval drop_hashcode_array[2][NO_PIECES][NO_SQUARES];
819 extern hashcode_array *hashcode;
820 extern drop_hashcode_array *drop_hashcode;
822 #ifdef QUIETBACKGROUND
823 extern short background;
824 #endif /* QUIETBACKGROUND */
827 extern short use_ttable;
828 extern struct hashentry *ttable[2];
832 * hashbd contains a 32 bit "signature" of the board position. hashkey
833 * contains a 16 bit code used to address the hash table. When a move is
834 * made, XOR'ing the hashcode of moved piece on the from and to squares with
835 * the hashbd and hashkey values keeps things current.
838 #define UpdateHashbd(side, piece, f, t) \
842 hashbd ^= (*hashcode)[side][piece][f].bd; \
843 hashkey ^= (*hashcode)[side][piece][f].key; \
848 hashbd ^= (*hashcode)[side][piece][t].bd; \
849 hashkey ^= (*hashcode)[side][piece][t].key; \
853 #define UpdateDropHashbd(side, piece, count) \
855 hashbd ^= (*drop_hashcode)[side][piece][count].bd; \
856 hashkey ^= (*drop_hashcode)[side][piece][count].key; \
860 extern short rpthash[2][256];
863 extern char* DRAW_REPETITION;
864 extern char *DRAW_MAXMOVES;
865 extern char *DRAW_JUSTDRAW;
867 #define row(a) ((a) / NO_COLS)
868 #define column(a) ((a) % NO_COLS)
869 #define locn(a, b) (((a) * NO_COLS) + b)
871 /* init external functions */
872 extern void InitConst(char *lang); /* init.c */
873 extern int Initialize_data(void); /* init.c */
874 extern void Free_data(void); /* init.c */
875 extern int Lock_data(void); /* init.c */
876 extern void Unlock_data(void); /* init.c */
877 extern void Initialize_dist(void); /* init.c */
878 extern void Initialize_eval(void); /* eval.c */
879 extern void NewGame(void);
880 extern int parse(FILE * fd, unsigned short *mv,
881 short side, char *opening);
882 extern void GetOpenings(void);
883 extern int OpeningBook(unsigned short *hint, short side);
887 REMOVE_PIECE = 1, ADD_PIECE
888 } UpdatePieceList_mode;
891 UpdatePieceList(short side, short sq, UpdatePieceList_mode iop);
895 FOREGROUND_MODE = 1, BACKGROUND_MODE
899 SelectMove(short side, SelectMove_mode iop);
907 unsigned short *bstline,
911 void PutInEETable(short side, int score);
912 int CheckEETable(short side);
913 int ProbeEETable(short side, short *score);
918 ProbeTTable(short side,
926 PutInTTable(short side,
934 extern void ZeroTTable(void);
935 extern void ZeroRPT(void);
936 extern void Initialize_ttable(void);
937 extern unsigned int urand(void);
940 extern void gsrand(unsigned int);
943 ProbeFTable(short side,
951 PutInFTable(short side,
960 # endif /* HASHFILE */
963 #if !defined SAVE_NEXTPOS
964 extern void Initialize_moves(void);
967 extern short generate_move_flags;
969 extern void MoveList(short side, short ply,
970 short in_check, short blockable);
971 extern void CaptureList(short side, short ply,
972 short in_check, short blockable);
976 SqAttacked(short square, short side, short *blockable);
988 UnmakeMove(short side,
996 InitializeStats(void);
1007 extern short ScorePosition(short side);
1008 extern void ExaminePosition(short side);
1009 extern short ScorePatternDistance(short side);
1010 extern void DetermineStage(short side);
1011 extern void UpdateWeights(short side);
1012 extern int InitMain(void);
1013 extern void ExitMain(void);
1014 extern void Initialize(void);
1015 extern void InputCommand(char *command);
1016 extern void ExitShogi(void);
1017 extern void ClearScreen(void);
1018 extern void SetTimeControl(void);
1019 extern void SelectLevel(char *sx);
1022 UpdateDisplay(short f,
1029 COMPUTE_AND_INIT_MODE = 1, COMPUTE_MODE
1030 #ifdef INTERRUPT_TEST
1031 , INIT_INTERRUPT_MODE, COMPUTE_INTERRUPT_MODE
1035 extern void SetResponseTime(short side);
1036 extern void CheckForTimeout(int score, int globalscore,
1037 int Jscore, int zwndw);
1038 extern void ShowSidetoMove(void);
1039 extern void ShowResponseTime(void);
1040 extern void ShowPatternCount(short side, short n);
1041 extern void SearchStartStuff(short side);
1042 extern void ShowDepth(char ch);
1043 extern void TerminateSearch(int);
1044 extern void ShowResults(short score, unsigned short *bstline, char ch);
1045 extern void SetupBoard(void);
1046 extern void algbr(short f, short t, short flag);
1047 extern void OutputMove(void);
1048 extern void ShowCurrentMove(short pnt, short f, short t);
1049 extern void ListGame(void);
1050 extern void ShowMessage(char *s);
1051 extern void ClearScreen(void);
1052 extern void DoDebug(void);
1053 extern void DoTable(short table[NO_SQUARES]);
1054 extern void ShowPostnValues(void);
1055 extern void ChangeXwindow(void);
1056 extern void SetContempt(void);
1057 extern void ChangeHashDepth(void);
1058 extern void ChangeBetaWindow(void);
1059 extern void GiveHint(void);
1060 extern void ShowPrompt(void);
1061 extern void EditBoard(void);
1062 extern void help(void);
1063 extern void ChangeSearchDepth(void);
1064 extern void skip(void);
1065 extern void skipb(void);
1066 extern void EnPassant(short xside, short f, short t, short iop);
1067 extern void ShowNodeCnt(long NodeCnt);
1068 extern void ShowLine(unsigned short *bstline);
1069 extern int pick(short p1, short p2);
1070 extern short repetition(void);
1071 extern void TimeCalc(void);
1072 extern void ElapsedTime(ElapsedTime_mode iop);
1075 DropPossible(short piece, short side, short sq); /* genmoves.c */
1078 IsCheckmate(short side, short in_check,
1079 short blockable); /* genmoves.c */
1084 VERIFY_AND_MAKE_MODE, VERIFY_AND_TRY_MODE, UNMAKE_MODE
1087 extern int VerifyMove(char *s, VerifyMove_mode iop, unsigned short *mv);
1088 extern unsigned short TTage;
1090 #include "dspwrappers.h" /* Display functions. */
1092 #endif /* _GNUSHOGI_H_ */