| 1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ |
| 2 | * This is GNU Go, a Go program. Contact gnugo@gnu.org, or see * |
| 3 | * http://www.gnu.org/software/gnugo/ for more information. * |
| 4 | * * |
| 5 | * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, * |
| 6 | * 2008 and 2009 by the Free Software Foundation. * |
| 7 | * * |
| 8 | * This program is free software; you can redistribute it and/or * |
| 9 | * modify it under the terms of the GNU General Public License as * |
| 10 | * published by the Free Software Foundation - version 3 or * |
| 11 | * (at your option) any later version. * |
| 12 | * * |
| 13 | * This program is distributed in the hope that it will be useful, * |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 16 | * GNU General Public License in file COPYING for more details. * |
| 17 | * * |
| 18 | * You should have received a copy of the GNU General Public * |
| 19 | * License along with this program; if not, write to the Free * |
| 20 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * |
| 21 | * Boston, MA 02111, USA. * |
| 22 | \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 23 | |
| 24 | |
| 25 | /* This file contains the global functions of the board library libboard.a. */ |
| 26 | |
| 27 | #include "board.h" |
| 28 | #include "hash.h" |
| 29 | |
| 30 | /* The board state itself. */ |
| 31 | int board_size = DEFAULT_BOARD_SIZE; /* board size */ |
| 32 | Intersection board[BOARDSIZE]; |
| 33 | int board_ko_pos; |
| 34 | int white_captured; /* number of black and white stones captured */ |
| 35 | int black_captured; |
| 36 | |
| 37 | Intersection initial_board[BOARDSIZE]; |
| 38 | int initial_board_ko_pos; |
| 39 | int initial_white_captured; |
| 40 | int initial_black_captured; |
| 41 | int move_history_color[MAX_MOVE_HISTORY]; |
| 42 | int move_history_pos[MAX_MOVE_HISTORY]; |
| 43 | Hash_data move_history_hash[MAX_MOVE_HISTORY]; |
| 44 | int move_history_pointer; |
| 45 | |
| 46 | float komi = 0.0; |
| 47 | int handicap = 0; |
| 48 | int movenum; |
| 49 | enum suicide_rules suicide_rule = FORBIDDEN; |
| 50 | enum ko_rules ko_rule = SIMPLE; |
| 51 | |
| 52 | |
| 53 | signed char shadow[BOARDMAX]; |
| 54 | |
| 55 | /* Hashing of positions. */ |
| 56 | Hash_data board_hash; |
| 57 | |
| 58 | int stackp; /* stack pointer */ |
| 59 | int position_number; /* position number */ |
| 60 | |
| 61 | /* Some statistics gathered partly in board.c and hash.c */ |
| 62 | struct stats_data stats; |
| 63 | |
| 64 | /* Variation tracking in SGF trees: */ |
| 65 | int count_variations = 0; |
| 66 | SGFTree *sgf_dumptree = NULL; |