ow_player Class Reference

#include <ow_player.h>

List of all members.

Public Member Functions

 ow_player (ow_board *owboard, int playernum, int boardside)
int makemovement (int boardside, int cellx, int celly)
int rcapture (int boardside, int cellx, int celly)
ow_move searchbestmove_ai ()
int foundbestmove_ai ()
int endofturn ()
void gosleep ()
void wakeup ()
int getplayernum ()
void setplayername (const char *pname)
void setplayer_aimode (int aimode)
void setplayer_aidepth (int depth)
void setplayer_aieval (int aieval)
char * getplayername ()
int getboardside ()
int getaimode ()
 ~ow_player ()

Public Attributes

cellXY selected_cell

Private Attributes

ow_boardowboard
int playernum
char playername [32]
int aimode
int aidepth
int aieval
int boardside
int sleep
ow_aisearchaisearch
int searchfound


Detailed Description

Author:
David Torres <aiken669@gmail.com>

Constructor & Destructor Documentation

ow_player::ow_player ( ow_board owboard,
int  playernum,
int  boardside 
)

Creates a new 'ow_player' object, based on the parameters.

Parameters:
owboard A pointer to the ow_board previously created.
playernum Player number (PL_PLAYER1,PL_PLAYER2).
boardside Side of the board (BRD_SIDE_NORTH, BRD_SIDE_SOUTH).
Returns:
New 'ow_player' object. The player is created as AI_HUMAN by default, you have to use setplayer_aimode() to change it

ow_player::~ow_player (  ) 

Deletes the 'ow_player' object.


Member Function Documentation

int ow_player::makemovement ( int  boardside,
int  cellx,
int  celly 
)

Executes a movement. Usually called by AI_HUMAN players.

Parameters:
boardside Side of the board (BRD_SIDE_NORTH, BRD_SIDE_SOUTH).
cellx Xpos of the specified cell in the board bcells array.
celly Ypos of the specified cell in the board bcells array.
Returns:
0 on success, -1 on any error.

int ow_player::rcapture ( int  boardside,
int  cellx,
int  celly 
)

Executes a reverse movement, ending in capture. Usually called by AI_HUMAN players.

Parameters:
boardside Side of the board (BRD_SIDE_NORTH, BRD_SIDE_SOUTH).
cellx Xpos of the specified cell in the board bcells array.
celly Ypos of the specified cell in the board bcells array.
Returns:
0 on success, -1 on any error.

ow_move ow_player::searchbestmove_ai (  ) 

Find best movement based on aimode.

Returns:
Cell to start the best AI move found

int ow_player::foundbestmove_ai (  ) 

Checks if AI found a new move, if so it was returned by the last searchbestmove_ai() call.

Returns:
1 if found, -1 if not found, 0 if still searching.

int ow_player::endofturn (  ) 

Checks if player has ended his turn

Returns:
1 if turn ended, 0 if turn still running

void ow_player::gosleep (  ) 

Sends the player to sleep, this usually means the player's turn ends.

void ow_player::wakeup (  ) 

Wake up from sleep, this usually means the player's turn begins.

int ow_player::getplayernum (  ) 

Returns the player number, used during the game.

Returns:
The player num.

void ow_player::setplayername ( const char *  pname  ) 

Sets a new name for player.

Parameters:
pname New name for the player.

void ow_player::setplayer_aimode ( int  aimode  ) 

Changes the AIMODE of the player. And creates the new aisearch() object for player to use.

Parameters:
aimode aimode to set (AI_HUMAN, AI_SIMPLE, AI_NEGAMAX, AI_ALPHABETA, AI_SCOUT)

void ow_player::setplayer_aidepth ( int  depth  ) 

Change the AIDEPTH of the player aisearch algoritm.

Parameters:
depth new aidepth value to set

void ow_player::setplayer_aieval ( int  aieval  ) 

Change the AIEVAL function of the player. And creates the new aisearch() object for player to use.

Parameters:
aieval aieval function to set (AI_RANDOM_EVAL,AI_MATERIAL_EVAL,AI_DISPERSION_EVAL,AI_MOBILITY_EVAL,AI_REACH_EVAL) Or combined aieval functions (AI_COMBINED_EVAL)

char * ow_player::getplayername (  ) 

Gets the name of the player.

Returns:
the player's name.

int ow_player::getboardside (  ) 

Returns side of the board where the player plays the game.

Returns:
Side of the board (BRD_SIDE_NORTH, BRD_SIDE_SOUTH).

int ow_player::getaimode (  ) 

Returns the AI mode used by the player.

Returns:
Player's Artificial Intelligence mode (AI_HUMAN, AI_COMPUTER, etc)


The documentation for this class was generated from the following files:
Generated on Sun Jun 22 13:45:48 2008 for Omweso by  doxygen 1.5.3