Main Page | Class Hierarchy | Class List | File List | Class Members

Board Class Reference

Board class representing state of game. More...

#include <board.h>

List of all members.

Public Member Functions

 Board ()
 Standard constructor.

 Board (int *map)
 Standard constructor with initialization.

 Board (int *map, int x, int y, int n)
 Standard constructor with initialization and setting position value.

int get (int x, int y)
 Gets value of position.

void set (int x, int y, int n)
 Sets value of position.

vector< Boardpossible_moves (int pl_no)
 Returns vector of boards of possible moves for player pl_no.

void move (int pl_no)
 Sets new move mark to player value.

void draw (BITMAP *b, int off_x, int off_y, int field_width)
 Draws the board on screen (bitmap).

bool operator== (Board &b)
 Compares a board with itself.

int depthSearchScore (unsigned char pl, int moveAt)
 Score of board for depth search.

int minimaxABScore (unsigned char pl)
 Score of board for minimax search.

bool isLegalMove (int px, int py, int pl_no)
 Tests if is legal move.

bool final ()
 Tests if this board has no possible moves for any player.

void print ()
 Prints debug information.


Public Attributes

int map [boardWidth *boardHeight]
 Map of board.


Detailed Description

Board class representing state of game.


Constructor & Destructor Documentation

Board::Board  ) 
 

Standard constructor.

Initializes the map array to zeros.

Board::Board int *  map  ) 
 

Standard constructor with initialization.

Constract object and initializez the map attribut with new data.

Parameters:
map Data to initializate from.

Board::Board int *  map,
int  x,
int  y,
int  n
 

Standard constructor with initialization and setting position value.

Initializes map attribut with data. And then set value of member at x,y position.

Parameters:
map Data to initialize from.
x The x coordinate of member to be set.
y The y coordinate of member to be set.
n The value of member to be set.

Here is the call graph for this function:


Member Function Documentation

int Board::depthSearchScore unsigned char  pl,
int  moveAt
 

Score of board for depth search.

This returns a score for the board, for player and his move.

Parameters:
pl The player number.
moveAt The last move of player.
Returns:
The score of board.

Here is the call graph for this function:

void Board::draw BITMAP *  b,
int  off_x,
int  off_y,
int  field_width
 

Draws the board on screen (bitmap).

This draws board in bitmap.

Parameters:
b The bitmap into will be drawn.
off_x The x offset in bitmap.
off_y The y offset in bitmap.
field_width The width of field (in pixels)

Here is the call graph for this function:

bool Board::final  ) 
 

Tests if this board has no possible moves for any player.

This function determinate if can player one or player two move on this board. In other words this check if this is final state of game.

Returns:
True if player one and player two can't move.

Here is the call graph for this function:

int Board::get int  x,
int  y
 

Gets value of position.

Returns the map attribute value of x, y position.

Parameters:
x The x coordinate of member to get.
y The y coordinate of member to get.
Returns:
The value of map attribute at position.

Here is the call graph for this function:

bool Board::isLegalMove int  px,
int  py,
int  pl_no
 

Tests if is legal move.

Tests if player number pl can legally put stone on px,py position of the board/

Parameters:
px The x position of player move.
py The y position of player move.
pl_no The nubmer of player.
Returns:
legallity of move.

Here is the call graph for this function:

int Board::minimaxABScore unsigned char  pl  ) 
 

Score of board for minimax search.

This returns a score of the board, for player. It's used for minimax search.

Parameters:
pl The player number.
Returns:
The score of board.

Here is the call graph for this function:

void Board::move int  pl_no  ) 
 

Sets new move mark to player value.

This search the map attribute until it findes the mark of new player move (= -1). Than this possiton sets to value, that repesents the occupation of this filed for player pl_no.

Parameters:
pl_no The number of player the move belongs.

Here is the call graph for this function:

bool Board::operator== Board b  ) 
 

Compares a board with itself.

Parameters:
b The board to be compared with.

Here is the call graph for this function:

vector< Board > Board::possible_moves int  pl_no  ) 
 

Returns vector of boards of possible moves for player pl_no.

This returns a STL vector of boards. This vector represents possible moves for player with number pl_no.

Parameters:
pl_no The nubmer of player for generating possible moves.
Returns:
A STL vector of possible_moves (boards) for player pl_no.

Here is the call graph for this function:

void Board::print  ) 
 

Prints debug information.

This prints debug information of state of this board on standard output.

Here is the call graph for this function:

void Board::set int  x,
int  y,
int  n
 

Sets value of position.

Sets the map attribute value of x, y position.

Parameters:
x The x coordinate of memeber to set.
y The y coordinate of memeber to set.
n The value of member to set.

Here is the call graph for this function:


Member Data Documentation

int Board::map[boardWidth *boardHeight]
 

Map of board.

This is array of int. Every member represents if this position is occuped by player one (=1), by player two (=2), or if it's free (=0). There's a special mark (=-1) that stands for position of next move of player.


The documentation for this class was generated from the following files:
Generated on Fri May 14 02:44:26 2004 for Reversi by doxygen 1.3.7