blob: 97f3c94127bed00bcaa32ec657757db0c187da6b [file] [log] [blame]
Antoine Cellerierb4b34f02007-06-30 20:04:42 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2006 Alexander Levin
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Antoine Cellerierb4b34f02007-06-30 20:04:42 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _REVERSI_STRATEGY_H
23#define _REVERSI_STRATEGY_H
24
25#include "reversi-game.h"
26
27
28/* Function for making a move. Is called only for robots.
29 Should return the game history entry for the advised move if
30 a move has been considered or HISTORY_INVALID_ENTRY if no move
31 has been considered. The board should not be modified. */
32typedef move_t (*move_func_t)(const reversi_board_t *game, int color);
Antoine Celleriercd829642007-07-01 20:48:51 +000033typedef void (*init_func_t)(const reversi_board_t *game);
Antoine Cellerierb4b34f02007-06-30 20:04:42 +000034
35/* A playing party/strategy */
36typedef struct _game_strategy_t {
37 const bool is_robot; /* Is the player a robot or does it require user input? */
Antoine Celleriercd829642007-07-01 20:48:51 +000038 init_func_t init_func; /* Initialise strategy */
39 move_func_t move_func; /* Make a move */
Antoine Cellerierb4b34f02007-06-30 20:04:42 +000040} game_strategy_t;
41
42
43/* --- Possible playing strategies --- */
44extern const game_strategy_t strategy_human;
Antoine Cellerier9af42892007-07-01 17:51:38 +000045extern const game_strategy_t strategy_naive;
46extern const game_strategy_t strategy_simple;
Antoine Celleriercd829642007-07-01 20:48:51 +000047//extern const game_strategy_t strategy_ab;
48
49#define CHAOSNOISE 0.05 /**< Changerate of heuristic-value */
50#define CHAOSPROB 0.1 /**< Probability of change of the heuristic-value */
Antoine Cellerierb4b34f02007-06-30 20:04:42 +000051
52#endif