2 * endgame -- plays through a chess game ending. enjoy.
4 * Copyright (C) 2002 Blair Tennessy (tennessb@unbc.ca)
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation. No representations are made about the suitability of this
11 * software for any purpose. It is provided "as is" without express or
15 #ifndef __CHESSGAMES_H__
16 #define __CHESSGAMES_H__
18 /** structure for a chess game */
21 /** original board configuration */
22 int board[BOARDSIZE][BOARDSIZE];
28 moves in game. this is a slight hack: moves are encoded in
29 integer pairs (x,y). the first pair, _from_, determines the
30 piece to move. the second pair, _to_, determines where to move.
32 in case _to_ is held by another piece, that piece is taken.
33 (see drawTakePiece(), draw_chess())
35 in case the move promotes a pawn, we assume a queening.
36 (see drawMovingPiece())
39 castling, en passant, under-promotions. hack at will.
40 more games! feel free to encode favorites!
41 and this moves[40][4] junk. i love c!
47 ChessGame games[GAMES] = {
52 E. N. Somov-Nasimovitsch
53 White to play and win.
60 { 0, 0, 0, 0, 0, BKING, 0, 0},
61 { BPAWN, 0, BPAWN, 0, BPAWN, 0, 0, 0},
62 { 0, 0, BPAWN, 0, BPAWN, 0, 0, KNIGHT},
63 { PAWN, 0, ROOK, 0, 0, 0, 0, 0},
64 { PAWN, 0, 0, 0, KING, PAWN, 0, 0},
65 { 0, 0, 0, 0, 0, 0, 0, 0},
66 { BPAWN, 0, 0, 0, 0, 0, 0, PAWN},
67 { BBISHOP,0, 0, 0, 0, 0, 0, 0},
84 {3, 2, 4, 2}, /* pawn to bishop 5 */
85 {1, 5, 0, 3}, /* check */
87 {0, 3, 2, 4}, /* takes pawn */
91 {6, 3, 6, 1}, /* rook takes bishop */
104 White to play and win.
111 { 0, 0, 0, 0, 0, 0, 0, 0},
112 { 0, 0, 0, 0, 0, 0, 0, BPAWN},
113 { 0, 0, 0, 0, BPAWN, KING, 0, BKING},
114 { 0, 0, 0, 0, 0, ROOK, 0, 0},
115 { 0, 0, 0, 0, 0, 0, 0, 0},
116 { 0,BBISHOP, 0, 0, BROOK, 0, PAWN, 0},
117 { 0, 0, 0, 0, 0, 0, 0, 0},
118 { 0, 0, 0, 0, 0,BISHOP, 0, 0},
126 {6, 5, 6, 7}, /* check */
130 {5, 6, 4, 6}, /* ! */
141 White to play and win.
148 { 0, 0, 0, KNIGHT, 0, 0, 0, KNIGHT},
149 { 0, KING, BPAWN, BPAWN, 0, 0, 0, 0},
150 { 0, 0, 0, 0, 0, 0, 0, 0},
151 { 0, BKING, 0, 0, 0, 0, 0, 0},
152 { 0, PAWN, 0, 0, 0, BPAWN, 0, 0},
153 { PAWN, 0, PAWN, 0, 0, 0, 0, 0},
154 { 0, 0, 0, 0, 0, 0, 0, 0},
155 { 0, 0, 0, 0, 0, 0, 0, 0},
167 {3, 4, 5, 3}, /* ! */
170 {0, 0, 0, 0}, /* mull it over... */
176 #endif /* __CHESSGAMES_H__ */