Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HexPoint.hpp File Reference

#include <map>
#include <string>
#include <vector>
#include <utility>
#include "Benzene.hpp"
#include "Bitset.hpp"
#include "HexAssert.hpp"
#include "HexColor.hpp"
#include "HexPoints11x11.hpp"

Go to the source code of this file.

Namespaces

namespace  HexPointUtil
 

Utilities on HexPoints: converting to/from strings, testing for edges, converting to/from x/y coordinates, etc.


Typedefs

typedef std::map< HexPoint,
HexPoint
PointToPoint
 A map of points to points.
typedef std::pair< HexPoint,
HexPoint
HexPointPair
 Pair of HexPoints.
typedef std::set< HexPointHexPointSet
 Set of HexPoints.
typedef std::map< HexPoint,
bitset_t
PointToBitset
 Map of HexPoints to bitsets.
typedef std::vector< HexPointPointSequence
 A sequence of HexPoints.

Enumerations

enum  HexDirection {
  DIR_EAST = 0, DIR_NORTH_EAST, DIR_NORTH, DIR_WEST,
  DIR_SOUTH_WEST, DIR_SOUTH, NUM_DIRECTIONS
}
 

Delta arrays.

More...

Functions

std::string HexPointUtil::ToString (HexPoint p)
 Converts a HexPoint to a string.
std::string HexPointUtil::ToString (const HexPointPair &p)
 Converts a pair of HexPoints to a string.
std::string HexPointUtil::ToString (const PointSequence &lst)
 Returns a space separated output of points in lst.
std::string HexPointUtil::ToString (const bitset_t &b)
 Returns a string representation of the bitset's set bits.
HexPoint HexPointUtil::FromString (const std::string &name)
 Returns the HexPoint with the given name; INVALID_POINT otherwise.
void HexPointUtil::FromString (const std::string &str, PointSequence &pts)
 Reads a PointSequence from a string of space separated points.
bool HexPointUtil::isSwap (HexPoint c)
 Returns true if this point is a swap move.
bool HexPointUtil::isEdge (HexPoint c)
 Returns true if this point is an edge point.
bool HexPointUtil::isInteriorCell (HexPoint c)
 Returns true if this point is an interior cell.
HexPoint HexPointUtil::oppositeEdge (HexPoint edge)
 Returns the edge opposite the given edge.
HexPoint HexPointUtil::leftEdge (HexPoint edge)
 Returns the edge to the left of the given edge.
HexPoint HexPointUtil::rightEdge (HexPoint edge)
 Returns the edge to the right of the given edge.
HexPoint HexPointUtil::colorEdge1 (HexColor color)
 Returns a color's first edge.
HexPoint HexPointUtil::colorEdge2 (HexColor color)
 Returns a color's second edge.
bool HexPointUtil::isColorEdge (HexPoint cell, HexColor color)
 Returns true if cell is one of color's edges.
void HexPointUtil::pointToCoords (HexPoint cell, int &x, int &y)
 Converts cell into its x and y components, where.
HexPoint HexPointUtil::coordsToPoint (int x, int y)
 Returns the HexPoint corresponding to the given x and y coords.
int HexPointUtil::DeltaX (int dir)
 Returns the change in the x-coordinate when travelling in the given direction.
int HexPointUtil::DeltaY (int dir)
 Returns the change in the y-coordinate when travelling in the given direction.
std::ostream & operator<< (std::ostream &os, HexPoint p)
 Extends standard output operator to handle HexPoints.

Variables

static const HexPoint FIRST_SPECIAL = RESIGN
 The value of the first special HexPoint.
static const HexPoint FIRST_EDGE = NORTH
 The value of the first edge HexPoint.
static const HexPoint FIRST_CELL = HEX_CELL_A1
 The value of the first interior cell; this should always be A1.
Maximum dimensions.

If you are going to change either of these constants, make sure to synchronize the printed names in HexPointData with the enumerated interior cell constants below.

static const int MAX_WIDTH = 11
 The maximum width of a valid ConstBoard.
static const int MAX_HEIGHT = 11
 The maximum height of a valid ConstBoard.

Detailed Description

Definition in file HexPoint.hpp.


Typedef Documentation

typedef std::pair<HexPoint, HexPoint> HexPointPair

Pair of HexPoints.

Definition at line 146 of file HexPoint.hpp.

typedef std::set<HexPoint> HexPointSet

Set of HexPoints.

Definition at line 149 of file HexPoint.hpp.

typedef std::vector<HexPoint> PointSequence

A sequence of HexPoints.

Definition at line 155 of file HexPoint.hpp.

typedef std::map<HexPoint, bitset_t> PointToBitset

Map of HexPoints to bitsets.

Definition at line 152 of file HexPoint.hpp.

typedef std::map<HexPoint, HexPoint> PointToPoint

A map of points to points.

Definition at line 143 of file HexPoint.hpp.


Enumeration Type Documentation

Delta arrays.

On a hex board, we can travel only in the following six directions: EAST, NORTH_EAST, NORTH, WEST, SOUTH_WEST, SOUTH.

             | /  
             |/
         --- o ---
            /|
           / |
   
Enumerator:
DIR_EAST 
DIR_NORTH_EAST 
DIR_NORTH 
DIR_WEST 
DIR_SOUTH_WEST 
DIR_SOUTH 
NUM_DIRECTIONS 

Definition at line 173 of file HexPoint.hpp.


Function Documentation

std::ostream& operator<< ( std::ostream &  os,
HexPoint  p 
) [inline]

Extends standard output operator to handle HexPoints.

Definition at line 362 of file HexPoint.hpp.

References HexPointUtil::ToString().


Variable Documentation

const HexPoint FIRST_CELL = HEX_CELL_A1 [static]

The value of the first interior cell; this should always be A1.

Definition at line 138 of file HexPoint.hpp.

Referenced by ConstBoard::ComputePointList(), HexPointUtil::coordsToPoint(), ConstBoard::CreateIterators(), HexPointUtil::isInteriorCell(), and HexPointUtil::pointToCoords().

const HexPoint FIRST_EDGE = NORTH [static]

The value of the first edge HexPoint.

Definition at line 135 of file HexPoint.hpp.

Referenced by ConstBoard::CreateIterators(), PatternMatcherData::Initialize(), and PatternState::Update().

const HexPoint FIRST_SPECIAL = RESIGN [static]

The value of the first special HexPoint.

Definition at line 132 of file HexPoint.hpp.

Referenced by ConstBoard::ComputePointList(), and ConstBoard::CreateIterators().

const int MAX_HEIGHT = 11 [static]

The maximum height of a valid ConstBoard.

Definition at line 105 of file HexPoint.hpp.

Referenced by HexHtpEngine::CmdNewGame(), ConstBoard::ConstBoard(), and HexPointUtil::coordsToPoint().

const int MAX_WIDTH = 11 [static]


6 Jan 2011 Doxygen 1.6.3