Collection of groups. More...
#include <Groups.hpp>
Public Member Functions | |
Groups () | |
Creates an empty set of groups. | |
const Group & | GetGroup (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. | |
StoneBoard & | Board () |
Returns reference to board groups were computed on. | |
const StoneBoard & | Board () 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 | |
StoneBoard * | m_brd |
std::vector< Group > | m_groups |
std::vector< std::size_t > | m_group_index |
Friends | |
class | Group |
class | GroupBuilder |
class | GroupIterator |
Collection of groups.
Definition at line 146 of file Groups.hpp.
Groups::Groups | ( | ) | [inline] |
Creates an empty set of groups.
Definition at line 237 of file Groups.hpp.
const StoneBoard & Groups::Board | ( | ) | const [inline] |
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().
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().
Returns captain of point's group.
Definition at line 292 of file Groups.hpp.
References Group::Captain(), and GetGroup().
Referenced by VCBuilder::andClosure(), CaptainizeBitset(), VCCommands::CmdGetVCsBetween(), VCCommands::CmdVCIntersection(), VCCommands::CmdVCUnion(), GraphUtils::ComputeDigraph(), VCSetUtil::ConnectedTo(), VCBuilder::DoSearch(), BoardUtils::FindSplittingDecomposition(), and VCBuilder::MergeAndShrink().
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 |
Returns color of winning player, EMPTY if IsGameOver() is false.
Definition at line 96 of file Groups.cpp.
References HexPointUtil::colorEdge1(), HexPointUtil::colorEdge2(), EMPTY, and m_group_index.
Referenced by HexHtpEngine::CmdFinalScore(), BenzenePlayer::InitSearch(), IsGameOver(), EndgameUtils::IsLostGame(), and EndgameUtils::IsWonGame().
Returns index of point's group in all groups of color.
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.
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().
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().
Definition at line 277 of file Groups.hpp.
References Group::Captain(), GetGroup(), and Nbs().
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().
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().
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.
StoneBoard* Groups::m_brd [private] |
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] |
Definition at line 232 of file Groups.hpp.
Referenced by GroupIterator::boolean_test(), GroupBuilder::Build(), Group::ComputeColorsetNbs(), GroupIterator::FindNextInColorSet(), GetGroup(), NumGroups(), GroupIterator::operator*(), and GroupIterator::operator->().