Debian Codegraph @

src/board.h

raw
1 /* netToe Version 1.5.1
2 *
3 * Copyright 2013, 2014 Mats Erik Andersson <[email protected]>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef _BOARD_H
22 # define _BOARD_H
23
24 #define GAME_IS_ALIVE 0
25 #define GAME_IS_X_WIN 1
26 #define GAME_IS_O_WIN 2
27 #define GAME_IS_DRAW 3
28
29 #define INVALID_MOVE 0
30 #define VALID_MOVE 1
31
32 struct endpoints {
33 int first, last;
34 };
35
36 # ifndef NO_EXTERNALS
37 extern char c11, c12, c13;
38 extern char c21, c22, c23;
39 extern char c31, c32, c33;
40
41 # ifdef BOARD_CALCULATIONS
42 extern char *C11, *C12, *C13;
43 extern char *C21, *C22, *C23;
44 extern char *C31, *C32, *C33;
45
46 extern char * board[9];
47
48 extern struct endpoints winning_line[8];
49 # endif /* BOARD_CALCULATIONS */
50 # endif /* !NO_EXTERNALS */
51
52 void init_matrix (void);
53 int game_check (void);
54 int attempt_move (const char *, char);
55 #endif /* _BOARD_H */