Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgBalancer Class Reference

#include <SgUtil.h>

List of all members.

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 52 of file SgUtil.h.

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

Constructor & Destructor Documentation

SgBalancer::SgBalancer ( int  margin  ) 

Definition at line 55 of file SgUtil.h.

Member Function Documentation

int SgBalancer::Balance (  )  const

Definition at line 86 of file SgUtil.h.

References m_balance.

Referenced by operator<<().

int SgBalancer::Margin (  )  const

Definition at line 91 of file SgUtil.h.

References m_margin.

Referenced by operator<<().

int SgBalancer::NuCalls (  )  const

Definition at line 96 of file SgUtil.h.

References m_nuCalls.

Referenced by operator<<().

int SgBalancer::NuPlayed ( SgBlackWhite  color  )  const

Definition at line 101 of file SgUtil.h.

References m_played.

Referenced by operator<<().

int SgBalancer::NuRejected ( SgBlackWhite  color  )  const

Definition at line 106 of file SgUtil.h.

References m_rejected.

Referenced by operator<<().

bool SgBalancer::Play ( SgBlackWhite  color  ) 

Definition at line 63 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 112 of file SgUtil.h.

Referenced by Balance(), and Play().

const int SgBalancer::m_margin [private]

Definition at line 114 of file SgUtil.h.

Referenced by Margin(), and Play().

int SgBalancer::m_nuCalls [private]

Definition at line 113 of file SgUtil.h.

Referenced by NuCalls(), and Play().

SgBWArray<int> SgBalancer::m_played [private]

Definition at line 115 of file SgUtil.h.

Referenced by NuPlayed(), and Play().

SgBWArray<int> SgBalancer::m_rejected [private]

Definition at line 116 of file SgUtil.h.

Referenced by NuRejected(), and Play().

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

17 Jun 2010 Doxygen 1.4.7