1
/* GNU Chess 5.0 - output.c - output code
2
Copyright (c) 1999-2002 Free Software Foundation, Inc.
4
GNU Chess is based on the two research programs
5
Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft.
7
GNU Chess is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
12
GNU Chess is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with GNU Chess; see the file COPYING. If not, write to
19
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
Boston, MA 02111-1307, USA.
24
cracraft@ai.mit.edu, cracraft@stanfordalumni.org, cracraft@earthlink.net
35
/**************************************************************************
37
* Print out the time settings.
39
**************************************************************************/
43
void ShowMoveList (int ply)
44
/**************************************************************************
46
* Print out the move list.
48
**************************************************************************/
53
for (node = TreePtr[ply]; node < TreePtr[ply+1]; node++)
55
SANMove (node->move, ply);
56
printf ("%5s %3d\t", SANmv, SwapOff(node->move));
67
void ShowSmallBoard (void)
68
/*****************************************************************************
70
* Display the board. Not only that but display some useful information
71
* like whether enpassant is legal and castling state.
73
*****************************************************************************/
78
if (board.side == white)
83
if (board.flag & WKINGCASTLE)
85
if (board.flag & WQUEENCASTLE)
87
if (board.flag & BKINGCASTLE)
89
if (board.flag & BQUEENCASTLE)
93
printf (" %s", algbr[board.ep]);
96
for (r = 56; r >= 0; r -= 8)
98
for (c = 0; c < 8; c++)
101
if (board.b[white][pawn] & BitPosArray[sq])
103
else if (board.b[white][knight] & BitPosArray[sq])
105
else if (board.b[white][bishop] & BitPosArray[sq])
107
else if (board.b[white][rook] & BitPosArray[sq])
109
else if (board.b[white][queen] & BitPosArray[sq])
111
else if (board.b[white][king] & BitPosArray[sq])
113
else if (board.b[black][pawn] & BitPosArray[sq])
115
else if (board.b[black][knight] & BitPosArray[sq])
117
else if (board.b[black][bishop] & BitPosArray[sq])
119
else if (board.b[black][rook] & BitPosArray[sq])
121
else if (board.b[black][queen] & BitPosArray[sq])
123
else if (board.b[black][king] & BitPosArray[sq])
135
void ShowBitBoard (BitBoard *b)
136
/*****************************************************************************
138
* Just to print a lousy ascii board
140
*****************************************************************************/
145
for (r = 56; r >= 0; r -= 8)
147
for (c = 0; c < 8; c++)
149
if (*b & BitPosArray[r + c])
160
void ShowBoard (void)
161
/*****************************************************************************
163
* Display the board. Not only that but display some useful information
164
* like whether enpassant is legal and castling state.
166
*****************************************************************************/
171
if (board.side == white)
172
fprintf (ofp, "white ");
174
fprintf (ofp, "black ");
176
if (board.flag & WKINGCASTLE)
178
if (board.flag & WQUEENCASTLE)
180
if (board.flag & BKINGCASTLE)
182
if (board.flag & BQUEENCASTLE)
186
fprintf (ofp, " %s", algbr[board.ep]);
189
for (r = 56; r >= 0; r -= 8)
191
for (c = 0; c < 8; c++)
194
if (board.b[white][pawn] & BitPosArray[sq])
196
else if (board.b[white][knight] & BitPosArray[sq])
198
else if (board.b[white][bishop] & BitPosArray[sq])
200
else if (board.b[white][rook] & BitPosArray[sq])
202
else if (board.b[white][queen] & BitPosArray[sq])
204
else if (board.b[white][king] & BitPosArray[sq])
206
else if (board.b[black][pawn] & BitPosArray[sq])
208
else if (board.b[black][knight] & BitPosArray[sq])
210
else if (board.b[black][bishop] & BitPosArray[sq])
212
else if (board.b[black][rook] & BitPosArray[sq])
214
else if (board.b[black][queen] & BitPosArray[sq])
216
else if (board.b[black][king] & BitPosArray[sq])
226
void ShowCBoard (void)
227
/*****************************************************************************
231
*****************************************************************************/
235
for (r = 56; r >= 0; r -= 8)
237
for (c = 0; c < 8; c++)
239
printf ("%2c ", cboard[r + c] ? notation[cboard[r+c]] : '.');
247
void ShowMvboard (void)
248
/*****************************************************************************
250
* Print the Mvboard[] array.
252
*****************************************************************************/
256
for (r = 56; r >= 0; r -= 8)
258
for (c = 0; c < 8; c++)
260
printf ("%2d ", Mvboard[r + c]);
271
/* *********************************************
272
* We must handle the special case of an EPD *
273
* game where the first move is by black *
274
********************************************* */
279
printf (" White Black\n");
281
if ( ( board.side == white && GameCnt % 2 == 1 ) ||
282
( board.side == black && GameCnt % 2 == 0 ))
285
for (i = 0; i <= GameCnt; i += 2)
287
printf ("%3d. %-7s %-7s\n", i/2 + 1, Game[i].SANmv,
293
printf (" 1. %-7s\n", Game[0].SANmv);
295
for (i = 1; i <= GameCnt; i += 2)
297
printf ("%3d. %-7s %-7s\n", i/2 + 2, Game[i].SANmv,