This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

Pos Struct Reference

A struct describing a position in a game. More...

#include <game.h>


Data Fields

byte* board
 An array representing the pieces of each square. More...

int* render
 Additional information about how to render the square. More...

Player player
 Which player has the move. More...

void* state
 State information required to completely describe the position. More...

int num_moves
 The number of moves that have been made to reach the current position. More...

void* ui_state
 Client-side state information () (currently unused).


Detailed Description

A struct describing a position in a game.

Definition at line 212 of file game.h.


Field Documentation

byte * Pos::board
 

An array representing the pieces of each square.

The size of the array is board_wid * board_heit. For each pair (x, y), board[y * board_wid + x] is a value between 0 and num_pieces inclusive which gives the piece at the square (x, y). 0 always indicates an empty square. The origin of the coordinates is at the bottom left.

Definition at line 220 of file game.h.

int Pos::num_moves
 

The number of moves that have been made to reach the current position.

In two-player games, it represents the number of ply.

Definition at line 246 of file game.h.

Player Pos::player
 

Which player has the move.

Currently this is unused, and a separate argument gets passed to every function along with the Pos. This will change soon.

Definition at line 233 of file game.h.

int * Pos::render
 

Additional information about how to render the square.

For example, highlight, shade, hide etc. See RenderType

Definition at line 228 of file game.h.

void * Pos::state
 

State information required to completely describe the position.

Some games are stateful, which means that the position can not be completely described by the state of the board alone. In chess (chess.c), for example, we need to keep track of whether either player can castle, etc. The variable state points to a struct which is defined by the game. It is modified using the function game_newstate.

Definition at line 242 of file game.h.

void * Pos::ui_state
 

Client-side state information () (currently unused).

Definition at line 249 of file game.h.


The documentation for this struct was generated from the following file: