Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

VCSet Class Reference

Stores the connections for a board and color. More...

#include <VCSet.hpp>

List of all members.

Public Member Functions

 VCSet (const ConstBoard &brd, HexColor color)
 Creates a VCSet class on the given board size for color.
 VCSet (const VCSet &other)
 Copy constructor.
virtual ~VCSet ()
 Destructor.
HexColor Color () const
 Returns the color of this set of connections.
const ConstBoardBoard () const
 Returns the board the set is defined on.
int SoftLimit (VC::Type) const
 Returns soft limit for the given type of VC.
const VCListGetList (VC::Type type, HexPoint x, HexPoint y) const
 Returns the VCList between (x, y).
VCListGetList (VC::Type type, HexPoint x, HexPoint y)
 Returns the VCList between (x, y).
bool Exists (HexPoint x, HexPoint y, VC::Type type) const
 Determines if there is at least one valid connection between the given pair of cells for the color and VC type, x and y must both be the color of this connection set.
bool SmallestVC (HexPoint x, HexPoint y, VC::Type type, VC &out) const
 Copies the smallest connection between x and y of type into out, returns true if successful.
void VCs (HexPoint x, HexPoint y, VC::Type type, std::vector< VC > &out) const
 Stores the valid connections between x and y for color in out (which is cleared beforehand).
Modifying methods

void SetSoftLimit (VC::Type, int limit)
 See SoftLimit().
void Clear ()
 Clears the connections.
VCList::AddResult Add (const VC &vc, ChangeLog< VC > *log)
 Attempts to add the given vc to the list between (vc.x(), vc.y()).
void Revert (ChangeLog< VC > &log)
 Uses the given changelog to revert connections to state at last marker in the changelog.
Operators

void operator= (const VCSet &other)
 Assignment operator.
bool operator== (const VCSet &other) const
 Returns true if other is isomorphic to us.
bool operator!= (const VCSet &other) const
 Returns true if other is not isomorphic to us.

Private Member Functions

void AllocateAndCopyLists (const VCSet &other)
 Allocates space for, and copies lists from, the VCLists in other.
void FreeLists ()
 Frees all allocated VCLists.

Private Attributes

const ConstBoardm_brd
HexColor m_color
VCListm_vc [VC::NUM_TYPES][BITSETSIZE][BITSETSIZE]
 The lists of vcs.

Detailed Description

Stores the connections for a board and color.

Definition at line 24 of file VCSet.hpp.


Constructor & Destructor Documentation

VCSet::VCSet ( const ConstBoard brd,
HexColor  color 
)

Creates a VCSet class on the given board size for color.

Definition at line 16 of file VCSet.cpp.

References ConstBoard::EdgesAndInterior(), VC::FULL, m_brd, m_vc, and VC::SEMI.

VCSet::VCSet ( const VCSet other  ) 

Copy constructor.

Definition at line 41 of file VCSet.cpp.

References AllocateAndCopyLists().

VCSet::~VCSet (  )  [virtual]

Destructor.

Definition at line 73 of file VCSet.cpp.

References FreeLists().


Member Function Documentation

VCList::AddResult VCSet::Add ( const VC vc,
ChangeLog< VC > *  log 
) [inline]

Attempts to add the given vc to the list between (vc.x(), vc.y()).

Returns result of the add operation. This method is just a wrapper for GetList(vc.type(), vc.x(), vc.y())->add(vc).

See also:
VCList::add()

Definition at line 156 of file VCSet.hpp.

References VCList::add(), m_vc, VC::type(), VC::x(), and VC::y().

Referenced by VCBuilder::AddBaseVCs(), VCBuilder::AddNewFull(), and VCBuilder::AddPatternVCs().

void VCSet::AllocateAndCopyLists ( const VCSet other  )  [private]

Allocates space for, and copies lists from, the VCLists in other.

Definition at line 56 of file VCSet.cpp.

References ConstBoard::EdgesAndInterior(), VC::FULL, m_brd, m_vc, and VC::SEMI.

Referenced by operator=(), and VCSet().

const ConstBoard & VCSet::Board (  )  const [inline]

Returns the board the set is defined on.

Definition at line 138 of file VCSet.hpp.

References m_brd.

Referenced by VCSetUtil::EqualOnGroups().

void VCSet::Clear (  ) 

Clears the connections.

Definition at line 124 of file VCSet.cpp.

References VCList::clear(), ConstBoard::EdgesAndInterior(), m_brd, m_vc, and VC::NUM_TYPES.

Referenced by VCBuilder::Build().

HexColor VCSet::Color (  )  const [inline]

Returns the color of this set of connections.

Definition at line 133 of file VCSet.hpp.

References m_color.

Referenced by VCBuilder::Build(), VCSetUtil::ComputeStatistics(), VCSetUtil::ConnectedTo(), and VCSetUtil::EqualOnGroups().

bool VCSet::Exists ( HexPoint  x,
HexPoint  y,
VC::Type  type 
) const

Determines if there is at least one valid connection between the given pair of cells for the color and VC type, x and y must both be the color of this connection set.

Definition at line 91 of file VCSet.cpp.

References VCList::empty(), and m_vc.

Referenced by VCSetUtil::ConnectedTo(), VCBuilder::DoSearch(), VCUtils::GetMustplay(), DfsSolver::OrderMoves(), and SmallestVC().

void VCSet::FreeLists (  )  [private]

Frees all allocated VCLists.

Definition at line 78 of file VCSet.cpp.

References ConstBoard::EdgesAndInterior(), m_brd, m_vc, and VC::NUM_TYPES.

Referenced by operator=(), and ~VCSet().

VCList & VCSet::GetList ( VC::Type  type,
HexPoint  x,
HexPoint  y 
) [inline]

Returns the VCList between (x, y).

Definition at line 150 of file VCSet.hpp.

References m_vc.

const VCList & VCSet::GetList ( VC::Type  type,
HexPoint  x,
HexPoint  y 
) const [inline]
bool VCSet::operator!= ( const VCSet other  )  const

Returns true if other is not isomorphic to us.

Definition at line 185 of file VCSet.cpp.

References operator==().

void VCSet::operator= ( const VCSet other  ) 

Assignment operator.

Definition at line 48 of file VCSet.cpp.

References AllocateAndCopyLists(), FreeLists(), m_brd, and m_color.

bool VCSet::operator== ( const VCSet other  )  const

Returns true if other is isomorphic to us.

Definition at line 167 of file VCSet.cpp.

References ConstBoard::EdgesAndInterior(), VC::FULL, m_brd, m_vc, and VC::SEMI.

Referenced by operator!=().

void VCSet::Revert ( ChangeLog< VC > &  log  ) 

Uses the given changelog to revert connections to state at last marker in the changelog.

Log will will have all entries and last marker removed.

Definition at line 135 of file VCSet.cpp.

References ChangeLog< T >::empty(), VCList::end(), VCList::find(), HexAssert, m_vc, ChangeLog< T >::pop(), VCList::remove(), VCList::simple_add(), ChangeLog< T >::topAction(), and ChangeLog< T >::topData().

void VCSet::SetSoftLimit ( VC::Type  type,
int  limit 
)

See SoftLimit().

Definition at line 116 of file VCSet.cpp.

References ConstBoard::EdgesAndInterior(), m_brd, and m_vc.

Referenced by HexEnvironmentCommands::ParamVC().

bool VCSet::SmallestVC ( HexPoint  x,
HexPoint  y,
VC::Type  type,
VC out 
) const

Copies the smallest connection between x and y of type into out, returns true if successful.

Returns false if no connection exists between x and y.

Definition at line 96 of file VCSet.cpp.

References VCList::begin(), Exists(), and m_vc.

Referenced by TwoDistance::IsAdjacent(), EndgameUtils::IsLostGame(), and EndgameUtils::IsWonGame().

int VCSet::SoftLimit ( VC::Type  type  )  const [inline]

Returns soft limit for the given type of VC.

This affects VCBuilder's performance!

Definition at line 161 of file VCSet.hpp.

References HexPointUtil::colorEdge1(), HexPointUtil::colorEdge2(), m_color, m_vc, and VCList::softlimit().

Referenced by HexEnvironmentCommands::ParamVC().

void VCSet::VCs ( HexPoint  x,
HexPoint  y,
VC::Type  type,
std::vector< VC > &  out 
) const

Stores the valid connections between x and y for color in out (which is cleared beforehand).

Definition at line 105 of file VCSet.cpp.

References VCList::begin(), VCList::end(), and m_vc.

Referenced by VCCommands::CmdGetVCsBetween().


Member Data Documentation

const ConstBoard* VCSet::m_brd [private]
See also:
Board()

Definition at line 122 of file VCSet.hpp.

Referenced by AllocateAndCopyLists(), Board(), Clear(), FreeLists(), operator=(), operator==(), SetSoftLimit(), and VCSet().

See also:
Color()

Definition at line 125 of file VCSet.hpp.

Referenced by Color(), operator=(), and SoftLimit().

VCList* VCSet::m_vc[VC::NUM_TYPES][BITSETSIZE][BITSETSIZE] [private]

The lists of vcs.

Todo:
use actual boardsize instead of BITSETSIZE?

Definition at line 130 of file VCSet.hpp.

Referenced by Add(), AllocateAndCopyLists(), Clear(), Exists(), FreeLists(), GetList(), operator==(), Revert(), SetSoftLimit(), SmallestVC(), SoftLimit(), VCs(), and VCSet().


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


6 Jan 2011 Doxygen 1.6.3