Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

BenzenePlayer Class Reference

Abstract base class for all players using the Benzene systems. More...

#include <BenzenePlayer.hpp>

Inheritance diagram for BenzenePlayer:
HexPlayer HandicapPlayer MoHexPlayer PerfectPlayer WolvePlayer

List of all members.

Public Member Functions

 BenzenePlayer ()
virtual ~BenzenePlayer ()
HexPoint GenMove (const HexState &state, const Game &game, HexBoard &brd, double maxTime, double &score)
 Generates a move from this board position.
bool SearchSingleton () const
 Search states with only a single move?
void SetSearchSingleton (bool flag)
 See SetSearchSingleton().
virtual std::string Name () const =0
 Returns a unique identifier for this player.

Protected Member Functions

bool FillinCausedWin () const
virtual HexPoint Search (const HexState &state, const Game &game, HexBoard &brd, const bitset_t &consider, double maxTime, double &score)=0
 Generates a move in the given gamestate.

Protected Attributes

bool m_fillinCausedWin
HexColor m_fillinWinner

Private Member Functions

HexPoint InitSearch (HexBoard &brd, HexColor color, bitset_t &consider, double &score)
 Finds inferior cells, builds vcs.
HexPoint CheckEndgame (HexBoard &brd, HexColor color, bitset_t &consider, double &score)

Private Attributes

bool m_search_singleton

Detailed Description

Abstract base class for all players using the Benzene systems.

Definition at line 19 of file BenzenePlayer.hpp.


Constructor & Destructor Documentation

BenzenePlayer::BenzenePlayer (  )  [explicit]

Definition at line 14 of file BenzenePlayer.cpp.

BenzenePlayer::~BenzenePlayer (  )  [virtual]

Definition at line 20 of file BenzenePlayer.cpp.


Member Function Documentation

HexPoint BenzenePlayer::CheckEndgame ( HexBoard brd,
HexColor  color,
bitset_t consider,
double &  score 
) [private]
bool BenzenePlayer::FillinCausedWin (  )  const [inline, protected]

Definition at line 86 of file BenzenePlayer.hpp.

References m_fillinCausedWin.

Referenced by PerfectPlayer::Search().

HexPoint BenzenePlayer::GenMove ( const HexState state,
const Game game,
HexBoard brd,
double  maxTime,
double &  score 
) [virtual]

Generates a move from this board position.

If the game is already over (somebody has won), returns RESIGN.

Derived Benzene players that use different search algorithms should not extend this method, but the protected virtual method Search() below.

If state is terminal (game over, vc/fill-in win/loss), returns "appropriate" move. Otherwise, calls Search().

Bug:
Subtract time spent to here from max_time after each step.

Implements HexPlayer.

Definition at line 27 of file BenzenePlayer.cpp.

References CheckEndgame(), InitSearch(), INVALID_POINT, LogInfo(), Search(), and HexState::ToPlay().

Referenced by MoHexEngine::DoSearch(), WolveEngine::GenMove(), PlayAndSolve::PlayerThread::operator()(), and BookBuilder< PLAYER >::Worker::operator()().

HexPoint BenzenePlayer::InitSearch ( HexBoard brd,
HexColor  color,
bitset_t consider,
double &  score 
) [private]

Finds inferior cells, builds vcs.

Sets moves to consider to all empty cells. If fillin causes terminal state, sets m_fillinCausedWin to true and recomputes fillin/vcs with ice temporarily turned off (so it can pass the players a non-empty consider set).

Definition at line 52 of file BenzenePlayer.cpp.

References GroupBuilder::Build(), HexBoard::ComputeAll(), EMPTY, StoneBoard::GetEmpty(), HexBoard::GetGroups(), HexBoard::GetPosition(), Groups::GetWinner(), HexAssert, IMMEDIATE_LOSS, INVALID_POINT, Groups::IsGameOver(), LogInfo(), m_fillinCausedWin, m_fillinWinner, RESIGN, StoneBoard::SetPosition(), HexBoard::SetUseICE(), and HexBoard::UseICE().

Referenced by GenMove().

virtual std::string HexPlayer::Name (  )  const [pure virtual, inherited]

Returns a unique identifier for this player.

Implemented in MoHexPlayer, HandicapPlayer, PerfectPlayer, and WolvePlayer.

virtual HexPoint BenzenePlayer::Search ( const HexState state,
const Game game,
HexBoard brd,
const bitset_t consider,
double  maxTime,
double &  score 
) [protected, pure virtual]

Generates a move in the given gamestate.

Derived players must implement this method. Score can be stored in score.

Parameters:
state Position and color to play.
game Game history up to this point.
brd Board to use for work.
consider Moves to consider in this state.
maxTime Max time available for move.
score Score of the move to play.
Returns:
The move to play.

Implemented in MoHexPlayer, PerfectPlayer, and WolvePlayer.

Referenced by GenMove().

bool BenzenePlayer::SearchSingleton (  )  const [inline]

Search states with only a single move?

Definition at line 76 of file BenzenePlayer.hpp.

References m_search_singleton.

Referenced by MoHexEngine::MoHexParam(), and WolveEngine::WolveParam().

void BenzenePlayer::SetSearchSingleton ( bool  flag  )  [inline]

See SetSearchSingleton().

Definition at line 81 of file BenzenePlayer.hpp.

References m_search_singleton.

Referenced by MoHexEngine::MoHexParam(), and WolveEngine::WolveParam().


Member Data Documentation

Definition at line 46 of file BenzenePlayer.hpp.

Referenced by FillinCausedWin(), and InitSearch().

Definition at line 48 of file BenzenePlayer.hpp.

Referenced by InitSearch(), and PerfectPlayer::Search().

Definition at line 67 of file BenzenePlayer.hpp.

Referenced by CheckEndgame(), SearchSingleton(), and SetSearchSingleton().


The documentation for this class was generated from the following files:


6 Jan 2011 Doxygen 1.6.3