Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

Groups Class Reference

Collection of groups. More...

#include <Groups.hpp>

List of all members.

Public Member Functions

 Groups ()
 Creates an empty set of groups.
const GroupGetGroup (HexPoint point) const
 Returns point's group.
HexPoint CaptainOf (HexPoint point) const
 Returns captain of point's group.
bool IsCaptain (HexPoint point) const
 Returns true if point is captain of its group.
bool IsGameOver () const
 Returns true if black or white has won.
HexColor GetWinner () const
 Returns color of winning player, EMPTY if IsGameOver() is false.
bitset_t CaptainizeBitset (bitset_t locations) const
 Returns bitset with only the captains of any set groups.
StoneBoardBoard ()
 Returns reference to board groups were computed on.
const StoneBoardBoard () const
 See Board().
Group indexing methods.

std::size_t NumGroups () const
 Returns number of groups.
std::size_t NumGroups (HexColorSet colorset) const
 Returns number of groups with color belonging to colorset.
std::size_t NumGroups (HexColor color) const
 Returns number of groups of color.
std::size_t GroupIndex (HexPoint point, HexColorSet colorset) const
 Returns index of point's group in all groups belonging to to colorset.
std::size_t GroupIndex (HexPoint point, HexColor color) const
 Returns index of point's group in all groups of color.
Neighbor convenience methods.

bitset_t Nbs (HexPoint point) const
bitset_t Nbs (HexPoint point, HexColorSet colorset) const
bitset_t Nbs (HexPoint point, HexColor color) const
bitset_t Nbs (const Group &group) const
bitset_t Nbs (const Group &group, HexColorSet colorset) const
bitset_t Nbs (const Group &group, HexColor color) const

Private Attributes

StoneBoardm_brd
std::vector< Groupm_groups
std::vector< std::size_t > m_group_index

Friends

class Group
class GroupBuilder
class GroupIterator

Detailed Description

Collection of groups.

Todo:
If a HexPosition class is ever created, store the HexPosition for which these groups were computed.

Definition at line 146 of file Groups.hpp.


Constructor & Destructor Documentation

Groups::Groups (  )  [inline]

Creates an empty set of groups.

Definition at line 237 of file Groups.hpp.


Member Function Documentation

const StoneBoard & Groups::Board (  )  const [inline]

See Board().

Definition at line 307 of file Groups.hpp.

References m_brd.

StoneBoard & Groups::Board (  )  [inline]

Returns reference to board groups were computed on.

Does not guarantee the board is in the same state it was in when groups where computed.

Definition at line 302 of file Groups.hpp.

References m_brd.

Referenced by VCBuilder::Build(), ICEngine::CliqueCutsetDead(), ICEngine::ComputeDeadCaptured(), ICEngine::ComputeInferiorCells(), Resistance::ComputeScores(), VCSetUtil::ConnectedTo(), ICEngine::FillInMutualFillin(), ICEngine::FillinPermanentlyInferior(), and ICEngine::FillInVulnerable().

bitset_t Groups::CaptainizeBitset ( bitset_t  locations  )  const

Returns bitset with only the captains of any set groups.

Definition at line 105 of file Groups.cpp.

References CaptainOf(), StoneBoard::Const(), HexAssert, ConstBoard::IsLocation(), and m_brd.

Referenced by GroupBuilder::Build().

HexPoint Groups::CaptainOf ( HexPoint  point  )  const [inline]
const Group & Groups::GetGroup ( HexPoint  point  )  const [inline]

Returns point's group.

Definition at line 257 of file Groups.hpp.

References m_group_index, and m_groups.

Referenced by CaptainOf(), BenzeneHtpEngine::CmdGetAbsorbGroup(), IsCaptain(), VCBuilder::Merge(), Nbs(), and VCBuilder::RemoveAllContaining().

HexColor Groups::GetWinner (  )  const
std::size_t Groups::GroupIndex ( HexPoint  point,
HexColor  color 
) const [inline]

Returns index of point's group in all groups of color.

Todo:
Take this out? Only used in Resistance.

Definition at line 252 of file Groups.hpp.

References GroupIndex(), and HexColorSetUtil::Only().

std::size_t Groups::GroupIndex ( HexPoint  point,
HexColorSet  colorset 
) const

Returns index of point's group in all groups belonging to to colorset.

Todo:
Take this out? Only used in Resistance.

Definition at line 79 of file Groups.cpp.

Referenced by GroupIndex().

bool Groups::IsCaptain ( HexPoint  point  )  const [inline]

Returns true if point is captain of its group.

Definition at line 297 of file Groups.hpp.

References Group::Captain(), and GetGroup().

Referenced by VCBuilder::MergeAndShrink().

bool Groups::IsGameOver (  )  const

Returns true if black or white has won.

Definition at line 91 of file Groups.cpp.

References EMPTY, and GetWinner().

Referenced by HexBoard::HandleVCDecomposition(), BenzenePlayer::InitSearch(), GameUtil::IsGameOver(), EndgameUtils::PlayDeterminedState(), and MoHexPlayer::Search().

bitset_t Groups::Nbs ( const Group group,
HexColor  color 
) const [inline]

Definition at line 282 of file Groups.hpp.

References Group::Captain(), GetGroup(), Nbs(), and HexColorSetUtil::Only().

bitset_t Groups::Nbs ( const Group group,
HexColorSet  colorset 
) const [inline]

Definition at line 287 of file Groups.hpp.

References Group::Captain(), GetGroup(), and Nbs().

bitset_t Groups::Nbs ( const Group group  )  const [inline]

Definition at line 277 of file Groups.hpp.

References Group::Captain(), GetGroup(), and Nbs().

bitset_t Groups::Nbs ( HexPoint  point,
HexColor  color 
) const [inline]

Definition at line 267 of file Groups.hpp.

References GetGroup(), Group::Nbs(), and HexColorSetUtil::Only().

bitset_t Groups::Nbs ( HexPoint  point,
HexColorSet  colorset 
) const [inline]

Definition at line 272 of file Groups.hpp.

References GetGroup(), and Group::Nbs().

bitset_t Groups::Nbs ( HexPoint  point  )  const [inline]

Definition at line 262 of file Groups.hpp.

References GetGroup(), and Group::Nbs().

Referenced by GraphUtils::ComputeDigraph(), BoardUtils::FindSplittingDecomposition(), and Nbs().

std::size_t Groups::NumGroups ( HexColor  color  )  const [inline]

Returns number of groups of color.

Definition at line 247 of file Groups.hpp.

References NumGroups(), and HexColorSetUtil::Only().

std::size_t Groups::NumGroups ( HexColorSet  colorset  )  const

Returns number of groups with color belonging to colorset.

Definition at line 71 of file Groups.cpp.

std::size_t Groups::NumGroups (  )  const [inline]

Returns number of groups.

Definition at line 242 of file Groups.hpp.

References m_groups.

Referenced by Resistance::ComputeScores(), and NumGroups().


Friends And Related Function Documentation

friend class Group [friend]

Definition at line 224 of file Groups.hpp.

friend class GroupBuilder [friend]

Definition at line 226 of file Groups.hpp.

friend class GroupIterator [friend]

Definition at line 228 of file Groups.hpp.


Member Data Documentation

Definition at line 230 of file Groups.hpp.

Referenced by Board(), GroupBuilder::Build(), and CaptainizeBitset().

std::vector<std::size_t> Groups::m_group_index [private]

Definition at line 234 of file Groups.hpp.

Referenced by GroupBuilder::Build(), GetGroup(), and GetWinner().

std::vector<Group> Groups::m_groups [private]

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


6 Jan 2011 Doxygen 1.6.3