Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Private Attributes

SgBalancer Class Reference

Utility class to assure balance between black and white plays. More...

#include <SgUtil.h>

List of all members.

Public Member Functions

 SgBalancer (int margin)
bool Play (SgBlackWhite color)
int Balance () const
int Margin () const
int NuCalls () const
int NuPlayed (SgBlackWhite color) const
int NuRejected (SgBlackWhite color) const

Private Attributes

int m_balance
int m_nuCalls
const int m_margin
SgBWArray< int > m_played
SgBWArray< int > m_rejected

Detailed Description

Utility class to assure balance between black and white plays.

The difference between the number of plays by both colors is forced to be within the margin.

Definition at line 50 of file SgUtil.h.


Constructor & Destructor Documentation

SgBalancer::SgBalancer ( int  margin  ) 

Definition at line 53 of file SgUtil.h.


Member Function Documentation

int SgBalancer::Balance (  )  const

Definition at line 84 of file SgUtil.h.

References m_balance.

Referenced by operator<<().

int SgBalancer::Margin (  )  const

Definition at line 89 of file SgUtil.h.

References m_margin.

Referenced by operator<<().

int SgBalancer::NuCalls (  )  const

Definition at line 94 of file SgUtil.h.

References m_nuCalls.

Referenced by operator<<().

int SgBalancer::NuPlayed ( SgBlackWhite  color  )  const

Definition at line 99 of file SgUtil.h.

References m_played.

Referenced by operator<<().

int SgBalancer::NuRejected ( SgBlackWhite  color  )  const

Definition at line 104 of file SgUtil.h.

References m_rejected.

Referenced by operator<<().

bool SgBalancer::Play ( SgBlackWhite  color  ) 

Definition at line 61 of file SgUtil.h.

References m_balance, m_margin, m_nuCalls, m_played, m_rejected, SG_ASSERT, SG_BLACK, SG_WHITE, and SgIsBlackWhite().


Member Data Documentation

int SgBalancer::m_balance [private]

Definition at line 110 of file SgUtil.h.

Referenced by Balance(), and Play().

const int SgBalancer::m_margin [private]

Definition at line 112 of file SgUtil.h.

Referenced by Margin(), and Play().

int SgBalancer::m_nuCalls [private]

Definition at line 111 of file SgUtil.h.

Referenced by NuCalls(), and Play().

Definition at line 113 of file SgUtil.h.

Referenced by NuPlayed(), and Play().

Definition at line 114 of file SgUtil.h.

Referenced by NuRejected(), and Play().


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


Sun Mar 13 2011 Doxygen 1.7.1