This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

othello.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <gdk/gdkkeysyms.h>
#include "game.h"
#include "aaball.h"

Go to the source code of this file.

Defines

#define OTHELLO_CELL_SIZE   55
#define OTHELLO_NUM_PIECES   2
#define OTHELLO_BOARD_WID   8
#define OTHELLO_BOARD_HEIT   8
#define OTHELLO_WP   1
#define OTHELLO_BP   2
#define OTHELLO_EMPTY   0

Enumerations

enum  { SAFE, UNSAFE, UNKNOWN }

Functions

int othello_getmove (Pos *, int, int, GtkboardEventType, Player, byte **, int **)
int othello_getmove_kb (Pos *pos, int key, Player player, byte **movp, int **rmovp)
void othello_init ()
ResultType othello_who_won (Pos *, Player, char **)
ResultType othello_eval (Pos *, Player, float *)
ResultType othello_eval_incr (Pos *, Player, byte *, float *)
byte* othello_movegen (Pos *)
char** othello_get_pixmap (int, int)
guchar* othello_get_rgbmap (int, int)
gboolean othello_use_incr_eval (Pos *pos, Player player)
int get_sandwich_len (Pos *pos, int x0, int y0, int dx, int dy, byte player)
gboolean hasmove (Pos *pos, Player player)
float othello_eval_count (Pos *pos)
int othello_eval_mobility_count (Pos *pos, int color)
float othello_eval_mobility (Pos *pos)
float othello_eval_liberty (Pos *pos)
 Faster approxmiation for mobility.

int othello_eval_num_moves (Pos *pos)
int othello_eval_is_safe (Pos *pos, int x, int y, byte our)
float othello_eval_safe (Pos *pos)
float othello_eval_material (Pos *pos)
float othello_eval_weights (Pos *pos)

Variables

char othello_colors [6] = {200, 200, 200, 140, 140, 140}
int othello_init_pos [OTHELLO_BOARD_WID *OTHELLO_BOARD_HEIT]
Game Othello
int incx [] = { -1, -1, -1, 0, 0, 1, 1, 1}
int incy [] = { -1, 0, 1, -1, 1, -1, 0, 1}
byte* safe_cached


Define Documentation

#define OTHELLO_BOARD_HEIT   8
 

Definition at line 32 of file othello.c.

#define OTHELLO_BOARD_WID   8
 

Definition at line 31 of file othello.c.

#define OTHELLO_BP   2
 

Definition at line 49 of file othello.c.

#define OTHELLO_CELL_SIZE   55
 

Definition at line 28 of file othello.c.

#define OTHELLO_EMPTY   0
 

Definition at line 50 of file othello.c.

#define OTHELLO_NUM_PIECES   2
 

Definition at line 29 of file othello.c.

#define OTHELLO_WP   1
 

Definition at line 48 of file othello.c.


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
SAFE  
UNSAFE  
UNKNOWN  

Definition at line 365 of file othello.c.


Function Documentation

int get_sandwich_len ( Pos * pos,
int x0,
int y0,
int dx,
int dy,
byte player ) [static]
 

Definition at line 137 of file othello.c.

Referenced by hasmove(), othello_eval_mobility_count(), othello_getmove(), and othello_movegen().

gboolean hasmove ( Pos * pos,
Player player ) [static]
 

Definition at line 153 of file othello.c.

Referenced by antichess_who_won(), othello_getmove(), and othello_getmove_kb().

ResultType othello_eval ( Pos * pos,
Player player,
float * eval )
 

Definition at line 487 of file othello.c.

float othello_eval_count ( Pos * pos ) [static]
 

Definition at line 294 of file othello.c.

ResultType othello_eval_incr ( Pos * pos,
Player player,
byte * move,
float * eval )
 

Definition at line 515 of file othello.c.

int othello_eval_is_safe ( Pos * pos,
int x,
int y,
byte our ) [static]
 

Definition at line 371 of file othello.c.

Referenced by othello_eval_safe().

float othello_eval_liberty ( Pos * pos ) [static]
 

Faster approxmiation for mobility.

Definition at line 334 of file othello.c.

Referenced by othello_eval().

float othello_eval_material ( Pos * pos ) [static]
 

Definition at line 447 of file othello.c.

Referenced by othello_eval().

float othello_eval_mobility ( Pos * pos ) [static]
 

Definition at line 327 of file othello.c.

int othello_eval_mobility_count ( Pos * pos,
int color ) [static]
 

Definition at line 305 of file othello.c.

Referenced by othello_eval_mobility().

int othello_eval_num_moves ( Pos * pos ) [static]
 

Definition at line 356 of file othello.c.

float othello_eval_safe ( Pos * pos ) [static]
 

Definition at line 397 of file othello.c.

Referenced by othello_eval().

float othello_eval_weights ( Pos * pos ) [static]
 

Definition at line 460 of file othello.c.

Referenced by othello_eval().

char** othello_get_pixmap ( int idx,
int color )
 

Definition at line 107 of file othello.c.

guchar* othello_get_rgbmap ( int idx,
int color )
 

Definition at line 120 of file othello.c.

int othello_getmove ( Pos * pos,
int x,
int y,
GtkboardEventType type,
Player to_play,
byte ** movp,
int ** rmovep )
 

Definition at line 184 of file othello.c.

int othello_getmove_kb ( Pos * pos,
int key,
Player player,
byte ** movp,
int ** rmovp )
 

Definition at line 174 of file othello.c.

void othello_init ( )
 

Definition at line 69 of file othello.c.

byte* othello_movegen ( Pos * pos )
 

Definition at line 251 of file othello.c.

gboolean othello_use_incr_eval ( Pos * pos,
Player player )
 

Definition at line 527 of file othello.c.

ResultType othello_who_won ( Pos * pos,
Player to_play,
char ** commp )
 

Definition at line 221 of file othello.c.


Variable Documentation

Game Othello
 

Initial value:

 { OTHELLO_CELL_SIZE, OTHELLO_BOARD_WID, OTHELLO_BOARD_HEIT, 
        OTHELLO_NUM_PIECES, 
        othello_colors, othello_init_pos, NULL, "Othello", othello_init}

Definition at line 64 of file othello.c.

int incx[] = { -1, -1, -1, 0, 0, 1, 1, 1} [static]
 

Definition at line 134 of file othello.c.

int incy[] = { -1, 0, 1, -1, 1, -1, 0, 1} [static]
 

Definition at line 135 of file othello.c.

char othello_colors[6] = {200, 200, 200, 140, 140, 140}
 

Definition at line 34 of file othello.c.

int othello_init_pos[OTHELLO_BOARD_WID*OTHELLO_BOARD_HEIT]
 

Initial value:

 
{
        0 , 0 , 0 , 0 , 0 , 0 , 0 , 0  ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 , 0  ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 , 0  ,
        0 , 0 , 0 , 2 , 1 , 0 , 0 , 0  ,
        0 , 0 , 0 , 1 , 2 , 0 , 0 , 0  ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 , 0  ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 , 0  ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 , 0  ,
}

Definition at line 36 of file othello.c.

byte* safe_cached [static]
 

Definition at line 367 of file othello.c.