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)
178 #include "dspwrappers.h" /* Display functions. */
181 #define SCORE_LIMIT 12000
183 /* masks into upper 16 bits of attacks array */
184 /* observe order of relative piece values */
185 #define CNT_MASK 0x000000FF
186 #define ctlP 0x00200000
187 #define ctlPp 0x00100000
188 #define ctlL 0x00080000
189 #define ctlN 0x00040000
190 #define ctlLp 0x00020000
191 #define ctlNp 0x00010000
192 #define ctlS 0x00008000
193 #define ctlSp 0x00004000
194 #define ctlG 0x00002000
195 #define ctlB 0x00001000
196 #define ctlBp 0x00000800
197 #define ctlR 0x00000400
198 #define ctlRp 0x00000200
199 #define ctlK 0x00000100
201 /* attack functions */
202 #define Pattack(c, u) (attack[c][u] > ctlP)
203 #define Anyattack(c, u) (attack[c][u] != 0)
205 /* hashtable flags */
206 #define truescore 0x0001
207 #define lowerbound 0x0002
208 #define upperbound 0x0004
209 #define kingcastle 0x0008
210 #define queencastle 0x0010
211 #define evalflag 0x0020
214 #define BlackKing PieceList[black][0]
215 #define WhiteKing PieceList[white][0]
216 #define OwnKing PieceList[c1][0]
217 #define EnemyKing PieceList[c2][0]
220 /* board properties */
221 #define InBlackCamp(sq) ((sq) < 27)
222 #define InWhiteCamp(sq) ((sq) > 53)
223 #define InPromotionZone(side, sq) \
224 (((side) == black) ? InWhiteCamp(sq) : InBlackCamp(sq))
227 #define OPENING_HINT 0x141d /* P7g-7f (20->29) */
243 /* piece code defines */
283 #define pmask 0x000f /* 15 */
284 #define promote 0x0010 /* 16 */
285 #define dropmask 0x0020 /* 32 */
286 #define exact 0x0040 /* 64 */
287 #define tesuji 0x0080 /* 128 */
288 #define check 0x0100 /* 256 */
289 #define capture 0x0200 /* 512 */
290 #define draw 0x0400 /* 1024 */
291 #define stupid 0x0800 /* 2048 */
292 #define questionable 0x1000 /* 4096 */
293 #define kingattack 0x2000 /* 8192 */
294 #define book 0x4000 /* 16384 */
296 /* move quality flags */
297 #define goodmove tesuji
298 #define badmove stupid
300 #define difficult questionable
309 /***************** Table limits ********************************************/
312 * ttblsz must be a power of 2. Setting ttblsz 0 removes the transposition
318 #elif defined SMALL_MEMORY
319 # if defined SAVE_SSCORE
320 # define vttblsz (1 << 12)
322 # if defined EXTRA_2MB
323 # define vttblsz (1 << 12)
325 # define vttblsz (1 << 10)
329 # define vttblsz (100001)
332 #if defined SMALL_MEMORY
333 # define MINTTABLE (0)
335 # define MINTTABLE (8000) /* min ttable size -1 */
338 #define ttblsz vttblsz
340 #if defined SMALL_MEMORY
341 # if !defined SAVE_SSCORE
342 # define TREE 1500 /* max number of tree entries */
344 # define TREE 2500 /* max number of tree entries */
347 # define TREE 4000 /* max number of tree entries */
350 #define MAXDEPTH 40 /* max depth a search can be carried */
351 #define MINDEPTH 2 /* min search depth =1 (no hint), >1 hint */
352 #define MAXMOVES 300 /* max number of half moves in a game */
353 #define CPSIZE 235 /* size of lang file max */
355 #if defined SMALL_MEMORY
356 # if defined SAVE_SSCORE
357 # define ETABLE (1 << 10) /* static eval cache */
359 # if defined EXTRA_2MB
360 # define ETABLE (1 << 10) /* static eval cache */
362 # define ETABLE (1 << 8) /* static eval cache */
366 # define ETABLE (10001) /* static eval cache */
369 /***************** tuning paramaters *******************/
371 #if defined VERY_SLOW_CPU
372 # define MINRESPONSETIME 300
373 #elif defined SLOW_CPU
374 # define MINRESPONSETIME 200
376 # define MINRESPONSETIME 100 /* 1 s */
381 #define CHKDEPTH 1 /* always look forward CHKDEPTH
382 * half-moves if in check */
384 #if defined SLOW_CPU || defined VERY_SLOW_CPU
385 # define DEPTHBEYOND 7 /* Max to go beyond Sdepth */
387 # define DEPTHBEYOND 11 /* Max to go beyond Sdepth */
390 #define HASHDEPTH 4 /* depth above which to use HashFile */
391 #define HASHMOVELIMIT 40 /* Use HashFile only for this many moves */
392 #define PTVALUE 0 /* material value below which pawn threats at
394 #define ZDEPTH 3 /* depth beyond which to check
395 * ZDELTA for extra time */
396 #define ZDELTA 10 /* score delta per ply to cause
397 * extra time to be given */
400 /* about 1/2 second worth of nodes for your machine */
401 #if defined VERY_SLOW_CPU
402 /* check the time every ZNODES positions */
403 # define ZNODES (flag.tsume ? 20 : 50)
404 #elif defined SLOW_CPU
405 # define ZNODES (flag.tsume ? 40 : 100)
407 # define ZNODES (flag.tsume ? 400 : 1000)
410 #define MAXTCCOUNTX 10 /* max number of time clicks
411 * per search to complete ply */
412 #define MAXTCCOUNTR 4 /* max number of time clicks
413 * per search extensions*/
414 #define SCORESPLIM 8 /* Score space doesn't apply after this stage */
415 #define SDEPTHLIM (Sdepth + 1)
416 #define HISTORYLIM 4096 /* Max value of history killer */
419 # if defined SMALL_MEMORY
420 # define HISTORY_MASK 0x8000 /* mask to MSB of history index */
421 # define HISTORY_SIZE 0x10000 /* size of history table */
423 # define HISTORY_MASK (1 << 15) /* mask to MSB of history index */
424 # define HISTORY_SIZE (1 << 16) /* size of history table */
427 /* smaller history table, but dangerous because of collisions */
428 # define HISTORY_MASK 0x3fff /* mask to significant bits
429 * of history index */
430 # if defined SMALL_MEMORY
431 # define HISTORY_SIZE 0x4000 /* size of history table */
433 # define HISTORY_SIZE (1 << 14) /* size of history table */
437 #define sizeof_history (sizeof(unsigned short) * (size_t)HISTORY_SIZE)
440 /* Map from.to (8bit.8bit) to from.to (0.7bit.8bit) */
441 # define khmove(mv) (mv & 0x7fff)
442 # define hmove(mv) ((mv & 0x7fff) ^ 0x5555)
444 /* Map from.to (8bit.8bit) to from.to (00.7bit.7bit) */
445 /* Swap bits of ToSquare in case of promotions, hoping that
446 no catastrophic collision occurs. */
447 # define khmove(mv) (((mv & 0x7f00) >> 1) | \
448 ((mv & 0x0080) ? ((mv & 0x007f) ^ 0x007f) : (mv & 0x007f)))
449 # define hmove(mv) (khmove(mv) ^ 0x2aaa)
452 /* mask color to 15th bit */
454 # define hindex(c, mv) ((c ? HISTORY_MASK : 0) | hmove(mv))
456 /* for white, swap bits, hoping that no catastrophic collision occurs. */
457 # define hindex(c, mv) (c ? ((~hmove(mv)) & HISTORY_MASK) : hmove(mv))
460 #define EWNDW 10 /* Eval window to force position scoring at depth
461 * greater than (Sdepth + 2) */
462 #define WAWNDW 90 /* alpha window when computer black */
463 #define WBWNDW 90 /* beta window when computer black */
464 #define BAWNDW 90 /* alpha window when computer white */
465 #define BBWNDW 90 /* beta window when computer white */
466 #define BXWNDW 90 /* window to force position scoring at lower */
467 #define WXWNDW 90 /* window to force position scoring at lower */
469 #define DITHER 5 /* max amount random can alter a pos value */
470 #define LBONUS 1 /* points per stage value of L increases */
471 #define BBONUS 2 /* points per stage value of B increases */
472 #define RBONUS 2 /* points per stage value of R increases */
474 #define QUESTIONABLE (valueK) /* Penalty for questionable moves. */
480 #define STUPID (valueR << 1) /* Penalty for stupid moves. */
482 #define KINGPOSLIMIT (-1) /* King positional scoring limit */
483 #define KINGSAFETY 32
484 #define MAXrehash (7)
486 /******* parameters for Opening Book ****************/
488 #define BOOKSIZE 8000 /* Number of unique position/move
489 * combinations allowed */
490 #define BOOKMAXPLY 40 /* Max plys to keep in book database */
491 #define BOOKFAIL (BOOKMAXPLY / 2) /* if no book move found for BOOKFAIL
492 * turns stop using book */
493 #define BOOKPOCKET 64
494 #define BOOKRAND 1000 /* used to select an opening move
496 #define BOOKENDPCT 950 /* 5 % chance a BOOKEND will stop the book */
497 #define DONTUSE -32760 /* flag move as don't use */
498 #define ILLEGAL_TRAPPED -32761 /* flag move as illegal:
499 * no move from this square */
500 #define ILLEGAL_DOUBLED -32762 /* flag move as illegal:
501 * two pawns on one column */
502 #define ILLEGAL_MATE -32763 /* flag move as illegal:
503 * pawn drop with mate */
505 /*****************************************************/
509 unsigned long key, bd;
514 unsigned long hashbd;
516 unsigned char depth; /* unsigned char saves some space */
523 unsigned char bd[PTBLBDSIZE];
524 #endif /* HASHTEST */
527 #if defined HASHFILE || defined CACHE
530 unsigned long ehashbd;
532 #if !defined SAVE_SSCORE
533 short sscore[NO_SQUARES];
538 unsigned char bd[PTBLBDSIZE];
539 #endif /* CACHETEST */
543 extern short use_etable;
544 typedef struct etable etable_field[ETABLE];
545 extern etable_field *etab[2];
549 * CHECKME! Is this valid?
551 * persistent transposition table. By default, the size is (1 << vfilesz).
552 * If you change the size, be sure to run gnushogi -c [vfilesz]
553 * before anything else.
558 #if defined SMALL_MEMORY
566 unsigned char bd[PTBLBDSIZE];
567 unsigned char f, t, flags, depth, sh, sl;
570 #endif /* HASHFILE */
576 short score, reply, width;
578 unsigned short flags;
584 unsigned short gmove; /* this move */
585 short score; /* score after this move */
586 short depth; /* search depth this move */
587 long time; /* search time this move */
588 short fpiece; /* moved or dropped piece */
589 short piece; /* piece captured */
590 short color; /* color */
591 short flags; /* move flags capture, promote, castle */
592 short Game50; /* flag for repetition */
593 long nodes; /* nodes searched for this move */
594 unsigned long hashkey, hashbd; /* board key before this move */
598 struct TimeControlRec
607 short mate; /* the game is over */
608 short post; /* show principle variation */
609 short quit; /* quit/exit */
610 short regularstart; /* did the game start from standard
612 short reverse; /* reverse board display */
613 short bothsides; /* computer plays both sides */
614 short hash; /* enable/disable transposition table */
615 short force; /* enter moves */
616 short easy; /* disable thinking on opponents time */
617 short beep; /* enable/disable beep */
618 short timeout; /* time to make a move */
619 short musttimeout; /* time to make a move */
620 short back; /* time to make a move */
621 short rcptr; /* enable/disable recapture heuristics */
622 short rv; /* reverse video */
623 short stars; /* add stars to uxdsp screen */
624 short coords; /* add coords to visual screen */
626 short material; /* draw on lack of material */
627 short illegal; /* illegal position */
628 short onemove; /* timing is onemove */
629 short gamein; /* timing is gamein */
630 short tsume; /* first consider checks */
633 extern FILE *debugfile;
636 #define EVALFILE "/tmp/EVAL"
639 extern FILE *debug_eval_file;
640 extern short debug_moves;
644 extern short use_history;
645 extern unsigned short *history;
650 extern char ColorStr[2][10];
652 extern char mvstr[4][6];
653 extern unsigned short MV[MAXDEPTH];
655 extern int mycnt1, mycnt2;
657 extern struct leaf rootnode;
658 extern struct leaf *Tree;
659 extern struct leaf *root;
660 extern char savefile[], listfile[];
661 extern short TrPnt[];
662 extern small_short board[], color[];
663 extern const small_short sweep[NO_PIECES];
664 extern small_short PieceList[2][NO_SQUARES], PawnCnt[2][NO_COLS];
665 extern small_short Captured[2][NO_PIECES];
668 # define ClearCaptured() \
670 short piece, color; \
671 for (color = black; color <= white; color++) \
672 for (piece = 0; piece < NO_PIECES; piece++) \
673 Captured[color][piece] = 0; \
676 # define ClearCaptured() \
677 memset((char *)Captured, 0, (unsigned long)sizeof(Captured))
678 #endif /* HAVE_MEMSET */
680 extern small_short Mvboard[];
682 #if !defined SAVE_SVALUE
683 extern short svalue[NO_SQUARES];
686 extern short pscore[2]; /* eval.c */
687 extern int EADD; /* eval.c */
688 extern int EGET; /* eval.c */
689 extern struct flags flag;
690 extern short opponent, computer, INCscore;
691 extern short WAwindow, BAwindow, WBwindow, BBwindow;
692 extern short dither, player;
693 extern short xwndw, contempt;
694 extern long ResponseTime, ExtraTime, TCleft,
695 MaxResponseTime, et, et0, time0, ft;
698 #ifdef INTERRUPT_TEST
699 extern long itime0, it;
702 extern long reminus, replus;
703 extern long GenCnt, NodeCnt, ETnodes, EvalNodes, HashAdd, HashCnt,
704 HashCol, THashCol, FHashCnt, FHashAdd;
705 extern short HashDepth, HashMoveLimit;
706 extern struct GameRec *GameList;
707 extern short GameCnt, Game50;
708 extern short Sdepth, MaxSearchDepth;
710 extern struct TimeControlRec TimeControl;
712 extern short TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
713 extern int timecomp[MINGAMEIN], timeopp[MINGAMEIN];
714 extern int compptr, oppptr;
715 extern short XCmore, XCmoves[], XCminutes[], XCseconds[], XC;
716 extern const short otherside[];
717 extern const small_short Stboard[];
718 extern const small_short Stcolor[];
719 extern unsigned short hint;
721 extern short stage, stage2;
723 #define in_opening_stage (!flag.tsume && (stage < 33))
724 #define in_middlegame_stage (!flag.tsume && (stage >= 33) && (stage <= 66))
725 #define in_endgame_stage (flag.tsume || (stage > 66))
727 extern short ahead, hash;
728 extern short balance[2];
729 extern small_short ChkFlag[], CptrFlag[], TesujiFlag[];
730 extern short Pscore[], Tscore[];
731 extern /*unsigned*/ short rehash; /* -1 is used as a flag --tpm */
732 extern char version[], patchlevel[];
733 extern unsigned int ttbllimit;
734 extern unsigned int TTadd;
735 extern unsigned int ttblsize;
736 extern short mtl[], hung[];
737 extern small_short Pindex[];
738 extern small_short PieceCnt[];
739 extern short FROMsquare, TOsquare;
740 extern small_short HasPiece[2][NO_PIECES];
741 extern const short kingP[];
742 extern unsigned short killr0[], killr1[];
743 extern unsigned short killr2[], killr3[];
744 extern unsigned short PrVar[MAXDEPTH];
745 extern unsigned short PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;
746 extern short mtl[2], pmtl[2], hung[2];
747 extern const small_short relative_value[];
748 extern const long control[];
749 extern small_short diagonal(short delta);
750 extern const small_short promoted[NO_PIECES], unpromoted[NO_PIECES];
751 extern const small_short is_promoted[NO_PIECES];
753 typedef unsigned char next_array[NO_SQUARES][NO_SQUARES];
754 typedef small_short distdata_array[NO_SQUARES][NO_SQUARES];
756 extern const small_short inunmap[NO_SQUARES];
757 extern const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 4)];
759 #if defined SAVE_NEXTPOS
760 extern const small_short direc[NO_PTYPE_PIECES][8];
761 extern short first_direction(short ptyp, short *d, short sq);
762 extern short next_direction(short ptyp, short *d, short sq);
763 extern short next_position(short ptyp, short *d, short sq, short u);
765 extern short use_nextpos;
766 extern next_array *nextpos[NO_PTYPE_PIECES];
767 extern next_array *nextdir[NO_PTYPE_PIECES];
770 extern value_array *value;
771 extern fscore_array *fscore;
773 #ifndef SAVE_DISTDATA
774 extern short use_distdata;
775 extern distdata_array *distdata;
778 #ifndef SAVE_PTYPE_DISTDATA
779 extern short use_ptype_distdata;
780 extern distdata_array *ptype_distdata[NO_PTYPE_PIECES];
783 extern const small_short ptype[2][NO_PIECES];
785 extern long filesz, hashmask, hashbase;
786 extern FILE *hashfile;
787 extern unsigned int starttime;
790 typedef small_short Mpiece_array[2][NO_SQUARES];
791 extern Mpiece_array *Mpiece[NO_PIECES];
792 extern short ADVNCM[NO_PIECES];
794 #define computed_distance(a, b) \
795 ((abs(column(a) - column(b)) > abs(row(a) - row(b))) \
796 ? abs(column(a) - column(b)) : abs(row(a) - row(b)))
798 extern short distance(short a, short b);
799 extern short ptype_distance(short ptyp, short f, short t);
800 extern short piece_distance(short side, short piece, short f, short t);
807 #define STATIC_ROOK 'S'
808 #define RANGING_ROOK 'R'
810 extern char GameType[2];
811 void ShowGameType(void);
813 extern unsigned short bookmaxply;
814 extern unsigned int bookcount;
815 extern unsigned int booksize;
816 extern unsigned long hashkey, hashbd;
818 typedef struct hashval hashcode_array[2][NO_PIECES][NO_SQUARES];
819 typedef struct hashval drop_hashcode_array[2][NO_PIECES][NO_SQUARES];
821 extern hashcode_array *hashcode;
822 extern drop_hashcode_array *drop_hashcode;
825 #ifdef QUIETBACKGROUND
826 extern short background;
827 #endif /* QUIETBACKGROUND */
830 extern short use_ttable;
831 extern struct hashentry *ttable[2];
835 * hashbd contains a 32 bit "signature" of the board position. hashkey
836 * contains a 16 bit code used to address the hash table. When a move is
837 * made, XOR'ing the hashcode of moved piece on the from and to squares with
838 * the hashbd and hashkey values keeps things current.
841 #define UpdateHashbd(side, piece, f, t) \
845 hashbd ^= (*hashcode)[side][piece][f].bd; \
846 hashkey ^= (*hashcode)[side][piece][f].key; \
851 hashbd ^= (*hashcode)[side][piece][t].bd; \
852 hashkey ^= (*hashcode)[side][piece][t].key; \
856 #define UpdateDropHashbd(side, piece, count) \
858 hashbd ^= (*drop_hashcode)[side][piece][count].bd; \
859 hashkey ^= (*drop_hashcode)[side][piece][count].key; \
863 extern short rpthash[2][256];
866 #define row(a) ((a) / NO_COLS)
867 #define column(a) ((a) % NO_COLS)
868 #define locn(a, b) (((a) * NO_COLS) + b)
870 /* init external functions */
871 extern void InitConst(char *lang); /* init.c */
872 extern int Initialize_data(void); /* init.c */
873 extern void Free_data(void); /* init.c */
874 extern int Lock_data(void); /* init.c */
875 extern void Unlock_data(void); /* init.c */
876 extern void Initialize_dist(void); /* init.c */
877 extern void Initialize_eval(void); /* eval.c */
878 extern void NewGame(void);
879 extern int parse(FILE * fd, unsigned short *mv,
880 short side, char *opening);
881 extern void GetOpenings(void);
882 extern int OpeningBook(unsigned short *hint, short side);
886 REMOVE_PIECE = 1, ADD_PIECE
887 } UpdatePieceList_mode;
890 UpdatePieceList(short side, short sq, UpdatePieceList_mode iop);
894 FOREGROUND_MODE = 1, BACKGROUND_MODE
898 SelectMove(short side, SelectMove_mode iop);
906 unsigned short *bstline,
910 void PutInEETable(short side, int score);
911 int CheckEETable(short side);
912 int ProbeEETable(short side, short *score);
917 ProbeTTable(short side,
925 PutInTTable(short side,
933 extern void ZeroTTable(void);
934 extern void ZeroRPT(void);
935 extern void Initialize_ttable(void);
936 extern unsigned int urand(void);
939 extern void gsrand(unsigned int);
942 ProbeFTable(short side,
950 PutInFTable(short side,
959 # endif /* HASHFILE */
962 #if !defined SAVE_NEXTPOS
963 extern void Initialize_moves(void);
966 extern short generate_move_flags;
968 extern void MoveList(short side, short ply,
969 short in_check, short blockable);
970 extern void CaptureList(short side, short ply,
971 short in_check, short blockable);
975 SqAttacked(short square, short side, short *blockable);
987 UnmakeMove(short side,
995 InitializeStats(void);
1006 extern short ScorePosition(short side);
1007 extern void ExaminePosition(short side);
1008 extern short ScorePatternDistance(short side);
1009 extern void DetermineStage(short side);
1010 extern void UpdateWeights(short side);
1011 extern int InitMain(void);
1012 extern void ExitMain(void);
1013 extern void Initialize(void);
1014 extern void InputCommand(char *command);
1015 extern void ExitShogi(void);
1016 extern void ClearScreen(void);
1017 extern void SetTimeControl(void);
1018 extern void SelectLevel(char *sx);
1021 UpdateDisplay(short f,
1028 COMPUTE_AND_INIT_MODE = 1, COMPUTE_MODE
1029 #ifdef INTERRUPT_TEST
1030 , INIT_INTERRUPT_MODE, COMPUTE_INTERRUPT_MODE
1034 extern void ElapsedTime(ElapsedTime_mode iop);
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 gotoXY(short x, short y);
1053 extern void ClearEoln(void);
1054 extern void DrawPiece(short sq);
1055 extern void UpdateClocks(void);
1056 extern void DoDebug(void);
1057 extern void DoTable(short table[NO_SQUARES]);
1058 extern void ShowPostnValues(void);
1059 extern void ChangeXwindow(void);
1060 extern void SetContempt(void);
1061 extern void ChangeHashDepth(void);
1062 extern void ChangeBetaWindow(void);
1063 extern void GiveHint(void);
1064 extern void ShowPrompt(void);
1065 extern void EditBoard(void);
1066 extern void help(void);
1067 extern void ChangeSearchDepth(void);
1068 extern void skip(void);
1069 extern void skipb(void);
1070 extern void EnPassant(short xside, short f, short t, short iop);
1071 extern void ShowNodeCnt(long NodeCnt);
1072 extern void ShowLine(unsigned short *bstline);
1073 extern int pick(short p1, short p2);
1074 extern short repetition(void);
1075 extern void TimeCalc(void);
1078 DropPossible(short piece, short side, short sq); /* genmoves.c */
1081 IsCheckmate(short side, short in_check,
1082 short blockable); /* genmoves.c */
1087 VERIFY_AND_MAKE_MODE, VERIFY_AND_TRY_MODE, UNMAKE_MODE
1090 extern int VerifyMove(char *s, VerifyMove_mode iop, unsigned short *mv);
1091 extern unsigned short TTage;
1093 #endif /* _GNUSHOGI_H_ */