f86637e49fcd851acd76ad22c520aba1ae638028
[gnushogi.git] / xshogi / xshogi.h
1 /*
2  * FILE: xshogi.h
3  *
4  *     Main header file for xshogi.
5  *
6  * ------------------------------------------------------------------------
7  * xshogi is based on XBoard -- an Xt/Athena user interface for GNU Chess.
8  *
9  * Original authors:                                Dan Sears, Chris Sears
10  * Enhancements (Version 2.0 and following):        Tim Mann
11  * Modifications to XShogi (Version 1.0):           Matthias Mutz
12  * Enhancements to XShogi (Version 1.1):            Matthias Mutz
13  * Modified implementation of ISS mode for XShogi:  Matthias Mutz
14  * Current maintainer:                              Michael C. Vanier
15  *
16  * XShogi borrows some of its piece bitmaps from CRANES Shogi.
17  *
18  * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
19  * Enhancements Copyright 1992 Free Software Foundation, Inc.
20  * Enhancements for XShogi Copyright 1993, 1994, 1995 Matthias Mutz
21  * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
22  *
23  * The following terms apply to Digital Equipment Corporation's copyright
24  * interest in XBoard:
25  * ------------------------------------------------------------------------
26  * All Rights Reserved
27  *
28  * Permission to use, copy, modify, and distribute this software and its
29  * documentation for any purpose and without fee is hereby granted,
30  * provided that the above copyright notice appear in all copies and that
31  * both that copyright notice and this permission notice appear in
32  * supporting documentation, and that the name of Digital not be
33  * used in advertising or publicity pertaining to distribution of the
34  * software without specific, written prior permission.
35  *
36  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
37  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
38  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
39  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
40  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
41  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
42  * SOFTWARE.
43  * ------------------------------------------------------------------------
44  *
45  * This file is part of GNU shogi.
46  *
47  * GNU shogi is free software; you can redistribute it and/or modify
48  * it under the terms of the GNU General Public License as published by
49  * the Free Software Foundation.
50  *
51  * GNU shogi is distributed in the hope that it will be useful,
52  * but WITHOUT ANY WARRANTY; without even the implied warranty of
53  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54  * GNU General Public License for more details.
55  *
56  * You should have received a copy of the GNU General Public License
57  * along with GNU shogi; see the file COPYING.  If not, write to
58  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
59  *
60  * ------------------------------------------------------------------------
61  *
62  */
63
64 #ifndef _XSHOGI_H_
65 #define _XSHOGI_H_
66
67 #define BOARD_SIZE      9
68 #define DROP_LINES      3
69 #define DROP_COLS       3
70
71 #ifdef WESTERN_BITMAPS
72 #define LARGE_SQUARE_SIZE    64
73 #define MEDIUM_SQUARE_SIZE   32
74 #else
75 #define LARGE_SQUARE_SIZE    64
76 #define MEDIUM_SQUARE_SIZE   49
77 #endif
78
79 #define SMALL_SQUARE_SIZE    32
80 #define LINE_GAP              2
81 #define MAX_MOVES           512
82 #define MSG_SIZ             256
83 #define DIALOG_SIZE         256
84 #define MOVE_
85 #define MOVE_LEN             16    /* enough for "Black resigns\000"*/
86 #define TIME_CONTROL         "5"   /* in minutes */
87 #define TIME_DELAY         "1.0"   /* seconds between moves */
88 #define MOVES_PER_SESSION    40    /* moves per TIME_CONTROL */
89 #define BlackOnMove(move)    ((int) ((move) % 2) == 0)
90
91 #define BELLCHAR                '\007'
92 #define NULLCHAR                '\000'
93
94 #ifndef FIRST_SHOGI_PROGRAM
95 #define FIRST_SHOGI_PROGRAM     "gnushogi"
96 #endif
97
98 #ifndef SECOND_SHOGI_PROGRAM
99 #define SECOND_SHOGI_PROGRAM    "gnushogi"
100 #endif
101
102 #ifndef FIRST_HOST
103 #define FIRST_HOST          "localhost"
104 #endif
105
106 #ifndef SECOND_HOST
107 #define SECOND_HOST         "localhost"
108 #endif
109
110 #define MATCH_MODE          "False"
111 #define INIT_STRING         "beep\neasy\nrandom\n"
112 #define BLACK_STRING        "black\ngo\n"
113 #define WHITE_STRING        "white\ngo\n"
114 #define DEFAULT_SIZE        "Large"
115 #define LIGHT               1
116 #define DARK                0
117 #define CHAR_PIECE_COLOR    "Black"
118 #define ZERO_COLOR          "#000000"
119 #define ONE_COLOR           "#FFFFFF"
120 #define PIECE_COLOR         "#FFFFD7"
121 #define SQUARE_COLOR        "#EBDFB0"
122 #define MAIN_FONT           "-*-helvetica-medium-o-normal--*-*-*-*-*-*-*-*"
123 #define COORD_FONT          "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*"
124 #define DEFAULT_FONT   "*font: -*-helvetica-medium-r-normal--*-120-*-*-*-*-*-*"
125 #define BLINK_COUNT          3
126 #define BORDER_X_OFFSET      3
127 #define BORDER_Y_OFFSET     27
128
129
130
131 typedef enum
132 {
133     Large, Medium, Small
134 } BoardSize;
135
136 typedef enum
137 {
138     BeginningOfGame, MachinePlaysBlack, MachinePlaysWhite, TwoMachinesPlay,
139     ForceMoves, PlayFromGameFile, PauseGame, EndOfGame,
140     EditPosition
141 } GameMode;
142
143 typedef enum
144 {
145     MatchFalse, MatchInit, MatchPosition, MatchOpening
146 } MatchMode;
147
148 typedef enum
149 {
150     BlackPawn,    BlackLance,   BlackKnight, BlackSilver, BlackGold,
151     BlackBishop,  BlackRook,    BlackPPawn,  BlackPLance, BlackPKnight,
152     BlackPSilver, BlackPBishop, BlackPRook,  BlackKing,
153     WhitePawn,    WhiteLance,   WhiteKnight, WhiteSilver, WhiteGold,
154     WhiteBishop,  WhiteRook,    WhitePPawn,  WhitePLance, WhitePKnight,
155     WhitePSilver, WhitePBishop, WhitePRook,  WhiteKing,
156     EmptySquare,
157     ClearBoard,   BlackPlay,    WhitePlay /* for use on EditPosition menus */
158 } ShogiSquare;
159
160 typedef ShogiSquare Board[BOARD_SIZE][BOARD_SIZE];
161
162 typedef int Catched[2][8];
163
164 typedef enum
165 {
166     BlackPromotion = 1, WhitePromotion, BlackDrop, WhiteDrop,
167         NormalMove,
168     BlackWins, WhiteWins, GameIsDrawn, StartGame, BadMove, Comment,
169     AmbiguousMove
170 } ShogiMove;
171
172 typedef enum
173 {
174     ResetTimers, DecrementTimers, SwitchTimers,
175     ReDisplayTimers, StopTimers, StartTimers
176 } ClockMode;
177
178
179 /*
180  * This is a hack that allows the parser to tell the program
181  * that the game it's loading has finished.
182  */
183
184 extern int loaded_game_finished;
185
186 #endif /* _XSHOGI_H_ */
187
188