5 ** Copyright (C) 1998 Kurt Van den Branden
7 ** This program 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 of the License, or
10 ** (at your option) any later version.
12 ** This program 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 this program; if not, write to the Free Software
19 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
42 listheader
* gipfextra
;
43 listheader
* rowextraw
;
44 listheader
* rowextrab
;
58 #define b_newboard() (board *) malloc (sizeof (board))
60 /* struct for moves */
67 /* lists with all possible moves */
68 extern fromto allmovesn
[];
69 extern fromto allmovesg
[];
71 /* all neighbours of board-positions */
72 extern unsigned char b_buren
[9][9][6][2];
77 #define T_TOURNAMENT 2
78 #define T_OTHER 3 /* can not be used for b_new !! */
80 /* possible values for status */
83 #define S_REMOVEGIPF 2
86 /* some macro's for easy programming */
87 extern int _colsize
[];
88 #define b_colsize(x) _colsize[x]
90 #define b_colnr(x) x - 'a'
92 extern char _colchar
[];
93 #define b_colchar(x) _colchar[x]
95 #define b_opponent(x) (x == 'o'? 'x' : 'o')
97 #define b_otherpiece(x) (x=='o' ? 'O' : (x=='O' ? 'o' : (x=='x' ? 'X' : 'x')))
99 #define b_gipf_position(x) postostr (x->pos)
100 #define b_gipf_owner(x) x->owner
102 #define b_status(x) x->status
103 /*#define b_row_extra(x) x->rowextra*/
104 #define b_gipf_extra(x) x->gipfextra
105 #define b_white(x) x->white
106 #define b_white_gipf(x) x->gipfwhite
107 #define b_white_lost(x) x->lostwhite
108 #define b_black(x) x->black
109 #define b_black_gipf(x) x->gipfblack
110 #define b_black_lost(x) x->lostblack
111 #define b_next_piece(x) x->nextpiece
112 #define b_winner(x) x->winner
113 #define b_move_counter(x) x->movecounter
115 #define b_nolog(x) x->log = NULL
116 #define b_setlog(x,y) x->log = y
117 #define b_colour(x,y) (y == 'o' ? x->white : x->black)
118 #define b_colour_gipf(x,y) (y == 'o' ? x->gipfwhite : x->gipfblack)
119 #define b_colour_lost(x,y) (y == 'o' ? x->lostwhite : x->lostblack)
120 #define b_colour_type(x,y) (y == 'o' ? x->typewhite : x->typeblack)
122 /* this uses a position as second parameter instead of a string in b_piece */
123 #define b_ppiece(x, y) x->pieces[y->col][y->row]
126 #define setremovewait(x,y) x->removewait = y
127 #define setanimate(x,y) x->animate = y
134 board
* b_new (int board_type
);
135 board
* b_copy (board
* orig_board
);
136 void b_print (board
* boardp
);
137 void b_del (board
* dboard
);
138 board
* b_move (board
* oboard
, char * from
, char * to
, char npiece
);
139 board
* b_remove_row (board
* oboard
, int rownr
);
140 board
* b_remove_gipf (board
* oboard
, rem_gipf
* rgipf
);
141 board
* b_checkfour (board
* oboard
);
142 rem_row
* b_rowoffour (board
* oboard
, int rownr
);
143 listheader
* b_row_extra (board
* oboard
);
145 char b_piece (board
* oboard
, char * strpos
);
146 int b_game_finished (board
* oboard
);
147 int b_compare (board
* board1
, board
* board2
);
148 board
* b_edit_piece (board
* oboard
, position
* pos
, char piece
);
149 board
* b_edit_lostwhite (board
* oboard
, int newval
);
150 board
* b_edit_lostblack (board
* oboard
, int newval
);
151 int b_to_file (board
* oboard
, FILE * fp
);
152 board
* b_from_file (FILE * fp
);
153 xmlite_entity
* b_to_xml (board
* oboard
);
154 board
* b_from_xml (xmlite_entity
* root
);