This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

knights.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "game.h"
#include "gdk/gdkkeysyms.h"
#include "../pixmaps/chess.xpm"
#include "../pixmaps/misc.xpm"

Go to the source code of this file.

Data Structures

struct  Knights_state

Defines

#define KNIGHTS_CELL_SIZE   54
#define KNIGHTS_NUM_PIECES   3
#define KNIGHTS_BOARD_WID   7
#define KNIGHTS_BOARD_HEIT   7
#define KNIGHTS_EMPTY   0
#define KNIGHTS_CLOSED   1
#define KNIGHTS_WN   2
#define KNIGHTS_BN   3

Functions

int knights_getmove (Pos *, int, int, GtkboardEventType, Player, byte **, int **)
int knights_getmove_kb (Pos *, int, Player, byte **, int **)
void knights_init ()
ResultType knights_who_won (Pos *, Player, char **)
ResultType knights_eval (Pos *, Player, float *eval)
ResultType knights_eval_real (Pos *, Player, float *eval, gboolean)
byte* knights_movegen (Pos *)
void* knights_newstate (Pos *, byte *)
void get_cur_pos (byte *board, Player player, int *x, int *y)
gboolean eval_disconnected (byte *theboard)
int eval_max_path_len (byte *theboard, Player player)

Variables

char knights_colors [] = {200, 200, 130, 0, 140, 0}
int knights_initpos [KNIGHTS_BOARD_WID *KNIGHTS_BOARD_HEIT]
char** knights_pixmaps []
Game Knights
int incx [] = { -2, -2, -1, -1, 1, 1, 2, 2}
int incy [] = { -1, 1, -2, 2, -2, 2, -1, 1}


Define Documentation

#define KNIGHTS_BN   3
 

Definition at line 38 of file knights.c.

#define KNIGHTS_BOARD_HEIT   7
 

Definition at line 33 of file knights.c.

#define KNIGHTS_BOARD_WID   7
 

Definition at line 32 of file knights.c.

#define KNIGHTS_CELL_SIZE   54
 

Definition at line 29 of file knights.c.

#define KNIGHTS_CLOSED   1
 

Definition at line 36 of file knights.c.

#define KNIGHTS_EMPTY   0
 

Definition at line 35 of file knights.c.

#define KNIGHTS_NUM_PIECES   3
 

Definition at line 30 of file knights.c.

#define KNIGHTS_WN   2
 

Definition at line 37 of file knights.c.


Function Documentation

gboolean eval_disconnected ( byte * theboard ) [static]
 

Definition at line 224 of file knights.c.

Referenced by knights_eval_real().

int eval_max_path_len ( byte * theboard,
Player player ) [static]
 

Definition at line 259 of file knights.c.

Referenced by knights_eval_real().

void get_cur_pos ( byte * board,
Player player,
int * x,
int * y ) [static]
 

Definition at line 116 of file knights.c.

Referenced by eval_disconnected(), eval_max_path_len(), knights_eval_real(), knights_getmove(), and knights_movegen().

ResultType knights_eval ( Pos * pos,
Player player,
float * eval ) [static]
 

Definition at line 365 of file knights.c.

ResultType knights_eval_real ( Pos * pos,
Player player,
float * eval,
gboolean strict ) [static]
 

Definition at line 303 of file knights.c.

Referenced by knights_eval(), and knights_who_won().

int knights_getmove ( Pos * pos,
int x,
int y,
GtkboardEventType type,
Player player,
byte ** movp,
int ** rmovp ) [static]
 

Definition at line 166 of file knights.c.

int knights_getmove_kb ( Pos * pos,
int key,
Player to_play,
byte ** movp,
int ** rmovp ) [static]
 

Definition at line 146 of file knights.c.

void knights_init ( )
 

Definition at line 79 of file knights.c.

byte* knights_movegen ( Pos * pos ) [static]
 

Definition at line 191 of file knights.c.

void* knights_newstate ( Pos * pos,
byte * move ) [static]
 

Definition at line 102 of file knights.c.

ResultType knights_who_won ( Pos * pos,
Player player,
char ** commp ) [static]
 

Definition at line 132 of file knights.c.


Variable Documentation

Game Knights
 

Initial value:

 { KNIGHTS_CELL_SIZE, KNIGHTS_BOARD_WID, KNIGHTS_BOARD_HEIT, 
        KNIGHTS_NUM_PIECES, 
        knights_colors, knights_initpos, knights_pixmaps, "Knights", knights_init}

Definition at line 75 of file knights.c.

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

Definition at line 99 of file knights.c.

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

Definition at line 100 of file knights.c.

char knights_colors[] = {200, 200, 130, 0, 140, 0}
 

Definition at line 40 of file knights.c.

int knights_initpos[KNIGHTS_BOARD_WID*KNIGHTS_BOARD_HEIT]
 

Initial value:

 
{
        3 , 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 ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 ,
        0 , 0 , 0 , 0 , 0 , 0 , 0 ,
        0 , 0 , 0 , 0 , 0 , 0 , 2 ,
}

Definition at line 42 of file knights.c.

char** knights_pixmaps[]
 

Initial value:

 
{
        grey_square_54_xpm,
        chess_wn_54_xpm,
        chess_bn_54_xpm,
}

Definition at line 54 of file knights.c.