Efficient implementation of a SgMiaiStrategy. More...
#include <SgMiaiMap.h>
Public Member Functions | |
SgMiaiMap () | |
Initialize to empty map. | |
void | ExecuteMove (SgPoint p, SgBlackWhite player) |
See SgStrategy::ExecuteMove. | |
SgPoint | ForcedMove () const |
See m_forcedMove. | |
SgStrategyStatus | Status () const |
See SgStrategyStatus. | |
void | ConvertFromSgMiaiStrategy (const SgMiaiStrategy &s) |
Convert SgMiaiStrategy into SgMiaiMap. | |
void | ConvertToSgMiaiStrategy (SgMiaiStrategy *s) const |
Convert SgMiaiMap into SgMiaiStrategy. | |
Private Attributes | |
SgPoint | m_forcedMove |
Move that must be played to stop or convert an open threat. | |
bool | m_failed |
Strategy has failed if opponent has occupied both points in a pair. | |
SgBWArray< SgArray< int, SG_MAXPOINT > > | m_map |
The maps, one for each color. |
Efficient implementation of a SgMiaiStrategy.
The miai strategy must be achievable (not broken). Uses two boards, one for each color. Board entries either point to the miai point, or are set to SG_NULLPOINT if the point is not part of a miai. Can only be used going forward through a game - does not support undo.
Definition at line 24 of file SgMiaiMap.h.
SgMiaiMap::SgMiaiMap | ( | ) |
Initialize to empty map.
Definition at line 13 of file SgMiaiMap.cpp.
void SgMiaiMap::ConvertFromSgMiaiStrategy | ( | const SgMiaiStrategy & | s | ) |
Convert SgMiaiStrategy into SgMiaiMap.
The SgMiaiStrategy must not have overlapping threats.
Definition at line 53 of file SgMiaiMap.cpp.
References SgMiaiStrategy::HasOverlappingMiaiPairs(), m_forcedMove, m_map, SgMiaiStrategy::MiaiStrategies(), SgMiaiStrategy::OpenThreatMove(), SgStrategy::Player(), SG_ASSERT, and SG_NULLPOINT.
void SgMiaiMap::ConvertToSgMiaiStrategy | ( | SgMiaiStrategy * | s | ) | const |
Convert SgMiaiMap into SgMiaiStrategy.
Definition at line 72 of file SgMiaiMap.cpp.
References SG_ASSERT, and SG_UNUSED().
void SgMiaiMap::ExecuteMove | ( | SgPoint | p, | |
SgBlackWhite | player | |||
) |
Definition at line 21 of file SgMiaiMap.cpp.
References m_forcedMove, m_map, SG_ASSERT, SG_NULLPOINT, and SgOppBW().
SgPoint SgMiaiMap::ForcedMove | ( | ) | const |
SgStrategyStatus SgMiaiMap::Status | ( | ) | const |
See SgStrategyStatus.
Definition at line 46 of file SgMiaiMap.cpp.
References m_failed, m_forcedMove, SG_NULLPOINT, SGSTRATEGY_FAILED, and SGSTRATEGY_THREATENED.
bool SgMiaiMap::m_failed [private] |
Strategy has failed if opponent has occupied both points in a pair.
Definition at line 51 of file SgMiaiMap.h.
Referenced by Status().
SgPoint SgMiaiMap::m_forcedMove [private] |
Move that must be played to stop or convert an open threat.
Returns SG_NULLPOINT if no such move.
Definition at line 48 of file SgMiaiMap.h.
Referenced by ConvertFromSgMiaiStrategy(), ExecuteMove(), ForcedMove(), and Status().
SgBWArray<SgArray<int,SG_MAXPOINT> > SgMiaiMap::m_map [private] |
The maps, one for each color.
Definition at line 54 of file SgMiaiMap.h.
Referenced by ConvertFromSgMiaiStrategy(), and ExecuteMove().