#include <ow_player.h>
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_board * | owboard |
int | playernum |
char | playername [32] |
int | aimode |
int | aidepth |
int | aieval |
int | boardside |
int | sleep |
ow_aisearch * | aisearch |
int | searchfound |
ow_player::ow_player | ( | ow_board * | owboard, | |
int | playernum, | |||
int | boardside | |||
) |
Creates a new 'ow_player' object, based on the 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). |
ow_player::~ow_player | ( | ) |
Deletes the 'ow_player' object.
int ow_player::makemovement | ( | int | boardside, | |
int | cellx, | |||
int | celly | |||
) |
Executes a movement. Usually called by AI_HUMAN players.
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. |
int ow_player::rcapture | ( | int | boardside, | |
int | cellx, | |||
int | celly | |||
) |
Executes a reverse movement, ending in capture. Usually called by AI_HUMAN players.
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. |
ow_move ow_player::searchbestmove_ai | ( | ) |
Find best movement based on aimode.
int ow_player::foundbestmove_ai | ( | ) |
Checks if AI found a new move, if so it was returned by the last searchbestmove_ai() call.
int ow_player::endofturn | ( | ) |
Checks if player has ended his turn
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.
void ow_player::setplayername | ( | const char * | pname | ) |
Sets a new name for player.
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.
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.
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.
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.
int ow_player::getboardside | ( | ) |
Returns side of the board where the player plays the game.
int ow_player::getaimode | ( | ) |
Returns the AI mode used by the player.