Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

VC Class Reference

Virtual Connection. More...

#include <VC.hpp>

List of all members.

Public Types

enum  Type { FULL, SEMI, NUM_TYPES }
 

Two types of Virtual VCSet: FULL and SEMI.

More...

Public Member Functions

 VC ()
 Constucts and empty VC with endpoints are (INVALID_POINT, INVALID_POINT).
 VC (HexPoint x, HexPoint y)
 Creates an empty VC between x and y: no key, empty carrier, VC_RULE_BASE.
 VC (HexPoint x, HexPoint y, const bitset_t &carrier, VcCombineRule from)
 Creates a 0-connection between x and y with the given carrier.
 VC (HexPoint x, HexPoint y, HexPoint key, const bitset_t &carrier, VcCombineRule from)
 Creates a 1-connection between x and y with the given carrier and key.
HexPoint x () const
 Returns the smaller of the two endpoints.
HexPoint y () const
 Returns the larger of the two endpoints.
HexPoint key () const
 Returns the key of the connection.
bitset_t carrier () const
 The set of cells required in order to realize this connection.
Type type () const
 Returns the type of connection.
VcCombineRule rule () const
 Returns rule used to construct this connection.
int count () const
 Returns the number of set bits in the carrier; this is cached so only takes constant time.
bool IsEmpty () const
 Returns true if the carrier is empty, false otherwise.
std::string toString () const
 Returns string representation of connection.
bool processed () const
 Returns true if this vc has been processed; false, otherwise.
void setProcessed (bool flag)
 Sets the processed flag.
bool operator== (const VC &o) const
 Two VCs are equal if their keys and carriers are equal.
bool operator!= (const VC &o) const
bool operator< (const VC &o) const
 Comparison is by the number of set bits in the carrier.
bool operator> (const VC &o) const
bool operator<= (const VC &o) const
bool isSubsetOf (const VC &o) const
 Is this a subset of o?

Static Public Member Functions

Static methods

static VC AndVCs (HexPoint x, HexPoint y, const VC &v1, const VC &v2)
 Returns a new full VC by unioning v1 and v2.
static VC AndVCs (HexPoint x, HexPoint y, const VC &v1, const VC &v2, const bitset_t &capturedSet)
static VC AndVCs (HexPoint x, HexPoint y, const VC &v1, const VC &v2, HexPoint key)
 Returns a new semi VC with key key by unioning v1 and v2.
static VC AndVCs (HexPoint x, HexPoint y, const VC &v1, const VC &v2, const bitset_t &capturedSet, HexPoint key)
static VC UpgradeSemi (const VC &v1, const bitset_t &takeout, HexPoint outx, HexPoint outy)
static VC ShrinkFull (const VC &v1, const bitset_t &takeout, HexPoint outx, HexPoint outy)
static VC ShrinkSemi (const VC &v1, const bitset_t &takeout, HexPoint outx, HexPoint outy)

Static Public Attributes

static const HexPoint NO_KEY = INVALID_POINT
 Full connections must have their keys set to NO_KEY.

Private Attributes

short m_x
 The smaller of the two endpoints.
short m_y
 The larger of the two endpoints.
short m_key
 The connection key; if NO_KEY, then this is a FULL connection, otherwise this is a SEMI connectin.
bitset_t m_carrier
 The empty cells that may be required to realize this connection.
byte m_rule
 The rule used to construct this connection.
byte m_processed
 Flag denoting whether this connection has been used to build other connections.
byte m_count
 Cached number of bits in the carrier.

Detailed Description

Virtual Connection.

Definition at line 66 of file VC.hpp.


Member Enumeration Documentation

enum VC::Type

Two types of Virtual VCSet: FULL and SEMI.

FULL (or "0") connections are second-player strategies guaranteeing the connection even if the opponent goes first. FULL must have their key set to NO_KEY.

SEMI (or "1") connections are first-player strategies; ie, the first player can make the connection if he is given one free move. This free move is called the "key" of the connection.

Enumerator:
FULL 
SEMI 
NUM_TYPES 

Definition at line 80 of file VC.hpp.


Constructor & Destructor Documentation

VC::VC (  ) 

Constucts and empty VC with endpoints are (INVALID_POINT, INVALID_POINT).

Definition at line 13 of file VC.cpp.

Referenced by AndVCs(), ShrinkFull(), ShrinkSemi(), and UpgradeSemi().

VC::VC ( HexPoint  x,
HexPoint  y 
)

Creates an empty VC between x and y: no key, empty carrier, VC_RULE_BASE.

Definition at line 24 of file VC.cpp.

VC::VC ( HexPoint  x,
HexPoint  y,
const bitset_t carrier,
VcCombineRule  from 
)

Creates a 0-connection between x and y with the given carrier.

Definition at line 35 of file VC.cpp.

VC::VC ( HexPoint  x,
HexPoint  y,
HexPoint  key,
const bitset_t carrier,
VcCombineRule  from 
)

Creates a 1-connection between x and y with the given carrier and key.

Definition at line 46 of file VC.cpp.

References HexAssert, m_carrier, SEMI, benzene_bitset< _Nb >::test(), and type().


Member Function Documentation

VC VC::AndVCs ( HexPoint  x,
HexPoint  y,
const VC v1,
const VC v2,
const bitset_t capturedSet,
HexPoint  key 
) [static]

Definition at line 103 of file VC.cpp.

References carrier(), HexAssert, BitsetUtil::IsSubsetOf(), VC(), and VC_RULE_AND.

VC VC::AndVCs ( HexPoint  x,
HexPoint  y,
const VC v1,
const VC v2,
HexPoint  key 
) [static]

Returns a new semi VC with key key by unioning v1 and v2.

Definition at line 97 of file VC.cpp.

References carrier(), HexAssert, VC(), and VC_RULE_AND.

VC VC::AndVCs ( HexPoint  x,
HexPoint  y,
const VC v1,
const VC v2,
const bitset_t capturedSet 
) [static]

Definition at line 89 of file VC.cpp.

References carrier(), HexAssert, BitsetUtil::IsSubsetOf(), VC(), and VC_RULE_AND.

VC VC::AndVCs ( HexPoint  x,
HexPoint  y,
const VC v1,
const VC v2 
) [static]

Returns a new full VC by unioning v1 and v2.

Definition at line 83 of file VC.cpp.

References carrier(), HexAssert, VC(), and VC_RULE_AND.

Referenced by VCBuilder::doAnd().

bitset_t VC::carrier (  )  const [inline]
int VC::count (  )  const [inline]

Returns the number of set bits in the carrier; this is cached so only takes constant time.

Definition at line 250 of file VC.hpp.

References m_count.

Referenced by operator<().

bool VC::IsEmpty (  )  const [inline]

Returns true if the carrier is empty, false otherwise.

Definition at line 255 of file VC.hpp.

References m_carrier, and benzene_bitset< _Nb >::none().

Referenced by TwoDistance::IsAdjacent().

bool VC::isSubsetOf ( const VC o  )  const [inline]

Is this a subset of o?

Definition at line 305 of file VC.hpp.

References BitsetUtil::IsSubsetOf(), and m_carrier.

Referenced by VCList::add().

HexPoint VC::key (  )  const [inline]

Returns the key of the connection.

Definition at line 230 of file VC.hpp.

References m_key.

Referenced by ShrinkFull(), ShrinkSemi(), toString(), and UpgradeSemi().

bool VC::operator!= ( const VC o  )  const [inline]

Definition at line 275 of file VC.hpp.

bool VC::operator< ( const VC o  )  const [inline]

Comparison is by the number of set bits in the carrier.

Definition at line 280 of file VC.hpp.

References count(), BitsetUtil::IsLessThan(), m_carrier, and m_key.

bool VC::operator<= ( const VC o  )  const [inline]

Definition at line 296 of file VC.hpp.

bool VC::operator== ( const VC o  )  const [inline]

Two VCs are equal if their keys and carriers are equal.

Definition at line 270 of file VC.hpp.

References m_carrier, and m_key.

bool VC::operator> ( const VC o  )  const [inline]

Definition at line 291 of file VC.hpp.

bool VC::processed (  )  const [inline]

Returns true if this vc has been processed; false, otherwise.

Definition at line 260 of file VC.hpp.

References m_processed.

VcCombineRule VC::rule (  )  const [inline]

Returns rule used to construct this connection.

Definition at line 245 of file VC.hpp.

References m_rule.

Referenced by ShrinkFull(), ShrinkSemi(), and toString().

void VC::setProcessed ( bool  flag  )  [inline]

Sets the processed flag.

ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING!

Should only be called inside of VCSet.

Definition at line 265 of file VC.hpp.

References m_processed.

VC VC::ShrinkFull ( const VC v1,
const bitset_t takeout,
HexPoint  outx,
HexPoint  outy 
) [static]

Definition at line 120 of file VC.cpp.

References carrier(), HexAssert, key(), NO_KEY, rule(), and VC().

Referenced by VCBuilder::MergeAndShrink().

VC VC::ShrinkSemi ( const VC v1,
const bitset_t takeout,
HexPoint  outx,
HexPoint  outy 
) [static]

Definition at line 128 of file VC.cpp.

References carrier(), HexAssert, key(), NO_KEY, rule(), benzene_bitset< _Nb >::test(), and VC().

Referenced by VCBuilder::MergeAndShrink().

std::string VC::toString (  )  const

Returns string representation of connection.

Definition at line 60 of file VC.cpp.

References carrier(), key(), rule(), SEMI, HexPointUtil::ToString(), type(), x(), and y().

Referenced by operator<<().

VC::Type VC::type (  )  const [inline]

Returns the type of connection.

Definition at line 240 of file VC.hpp.

References FULL, m_key, NO_KEY, and SEMI.

Referenced by VCSet::Add(), VCBuilder::AddNewFull(), toString(), and VC().

VC VC::UpgradeSemi ( const VC v1,
const bitset_t takeout,
HexPoint  outx,
HexPoint  outy 
) [static]

Definition at line 112 of file VC.cpp.

References carrier(), HexAssert, key(), NO_KEY, benzene_bitset< _Nb >::test(), VC(), and VC_RULE_AND.

Referenced by VCBuilder::MergeAndShrink().

HexPoint VC::x (  )  const [inline]

Returns the smaller of the two endpoints.

Definition at line 220 of file VC.hpp.

References m_x.

Referenced by VCSet::Add(), VCList::add(), VCBuilder::AddNewFull(), VCBuilder::AddNewSemi(), VCBuilder::andClosure(), VCList::simple_add(), and toString().

HexPoint VC::y (  )  const [inline]

Returns the larger of the two endpoints.

Definition at line 225 of file VC.hpp.

References m_y.

Referenced by VCSet::Add(), VCList::add(), VCBuilder::AddNewFull(), VCBuilder::AddNewSemi(), VCBuilder::andClosure(), VCList::simple_add(), and toString().


Member Data Documentation

The empty cells that may be required to realize this connection.

Definition at line 207 of file VC.hpp.

Referenced by carrier(), IsEmpty(), isSubsetOf(), operator<(), operator==(), and VC().

byte VC::m_count [private]

Cached number of bits in the carrier.

Used for sorting.

Definition at line 217 of file VC.hpp.

Referenced by count().

short VC::m_key [private]

The connection key; if NO_KEY, then this is a FULL connection, otherwise this is a SEMI connectin.

Definition at line 203 of file VC.hpp.

Referenced by key(), operator<(), operator==(), and type().

byte VC::m_processed [private]

Flag denoting whether this connection has been used to build other connections.

Definition at line 214 of file VC.hpp.

Referenced by processed(), and setProcessed().

byte VC::m_rule [private]

The rule used to construct this connection.

Definition at line 210 of file VC.hpp.

Referenced by rule().

short VC::m_x [private]

The smaller of the two endpoints.

Definition at line 196 of file VC.hpp.

Referenced by x().

short VC::m_y [private]

The larger of the two endpoints.

Definition at line 199 of file VC.hpp.

Referenced by y().

const HexPoint VC::NO_KEY = INVALID_POINT [static]

Full connections must have their keys set to NO_KEY.

Definition at line 83 of file VC.hpp.

Referenced by ShrinkFull(), ShrinkSemi(), type(), and UpgradeSemi().


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


6 Jan 2011 Doxygen 1.6.3