HOG2
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Witness< width, height > Class Template Reference

#include <Witness.h>

Inheritance diagram for Witness< width, height >:
Inheritance graph
[legend]
Collaboration diagram for Witness< width, height >:
Collaboration graph
[legend]

Classes

struct  mustCrossEdgeConstraint
 
struct  PathLocation
 
struct  separationObject
 

Public Types

enum  legality {
  kLegal, kNotAtEnd, kNotAtStart, kNotValidAction,
  kHitCannotCross, kHitStart, kHitLine
}
 

Public Member Functions

 Witness ()
 
 Witness (const Witness< width, height > &w)
 
Witness< width, height > & operator= (const Witness< width, height > &w)
 
void Reset ()
 
void GetSuccessors (const WitnessState< width, height > &nodeID, std::vector< WitnessState< width, height >> &neighbors) const
 
void GetActions (const WitnessState< width, height > &nodeID, std::vector< WitnessAction > &actions) const
 
void ApplyAction (WitnessState< width, height > &s, WitnessAction a) const
 
void ApplyAction (std::pair< int, int > &s, WitnessAction a) const
 
bool InvertAction (WitnessAction &a) const
 
void UndoAction (WitnessState< width, height > &s, WitnessAction a) const
 
bool Legal (WitnessState< width, height > &s, WitnessAction a) const
 
bool Legal (WitnessState< width, height > &s, WitnessAction a, legality &l) const
 
double HCost (const WitnessState< width, height > &node1, const WitnessState< width, height > &node2) const
 Heuristic value between two arbitrary nodes. More...
 
double GCost (const WitnessState< width, height > &node1, const WitnessState< width, height > &node2) const
 
double GCost (const WitnessState< width, height > &node, const WitnessAction &act) const
 
bool GoalTest (const WitnessState< width, height > &node, const WitnessState< width, height > &goal) const
 
bool GoalTest (const WitnessState< width, height > &node) const
 Goal Test if the goal is stored. More...
 
uint64_t GetMaxHash () const
 
uint64_t GetStateHash (const WitnessState< width, height > &node) const
 
void GetStateFromHash (uint64_t parent, WitnessState< width, height > &s) const
 
uint64_t GetActionHash (WitnessAction act) const
 
void OpenGLDraw () const
 
void OpenGLDraw (const WitnessState< width, height > &) const
 
void OpenGLDraw (const WitnessState< width, height > &, const WitnessState< width, height > &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
void OpenGLDraw (const WitnessState< width, height > &, const WitnessAction &) const
 
void GLLabelState (const WitnessState< width, height > &, const char *) const
 
void GLDrawLine (const WitnessState< width, height > &x, const WitnessState< width, height > &y) const
 
void DrawRegionConstraint (Graphics::Display &display, const WitnessRegionConstraint &constraint, const Graphics::point &p3) const
 
void Draw (Graphics::Display &display) const
 
void Draw (Graphics::Display &display, const WitnessState< width, height > &) const
 
void Draw (Graphics::Display &display, const InteractiveWitnessState< width, height > &) const
 
bool Click (Graphics::point, InteractiveWitnessState< width, height > &ws)
 
void Move (Graphics::point, InteractiveWitnessState< width, height > &ws)
 
const WitnessRegionConstraintGetRegionConstraint (int x, int y) const
 
void SetStart (int x, int y)
 
void AddStart (int x, int y)
 
void SetGoal (int x, int y)
 
bool AddGoal (int x, int y)
 
void ClearPathConstraints ()
 
void SetMustCrossConstraint (int)
 
bool GetMustCrossConstraint (int) const
 
bool GetMustCrossConstraint (int, int) const
 
bool GetMustCrossConstraint (bool, int, int) const
 
void ClearMustCrossConstraint (int)
 
void AddMustCrossConstraint (bool horiz, int x, int y)
 
void AddMustCrossConstraint (int x, int y)
 
void AddMustCrossConstraint (int)
 
void RemoveMustCrossConstraint (bool horiz, int x, int y)
 
void RemoveMustCrossConstraint (int x, int y)
 
constexpr int GetNumCannotCrossConstraints () const
 
void SetCannotCrossConstraint (int)
 
bool GetCannotCrossConstraint (int) const
 
bool GetCannotCrossConstraint (int, int) const
 
bool GetCannotCrossConstraint (bool, int, int) const
 
void ClearCannotCrossConstraint (int)
 
void AddCannotCrossConstraint (bool horiz, int x, int y)
 
void AddCannotCrossConstraint (int x, int y)
 
void AddCannotCrossConstraint (int)
 
void RemoveCannotCrossConstraint (bool horiz, int x, int y)
 
void RemoveCannotCrossConstraint (int x, int y)
 
void ClearInnerConstraints ()
 
void ClearConstraint (WitnessRegionConstraintType t)
 
void RemoveRegionConstraint (int x, int y)
 
void ClearTriangleConstraints ()
 
void AddTriangleConstraint (int x, int y, int count)
 
void AddTriangleConstraint (int which, int count)
 
void ClearSeparationConstraints ()
 
void AddSeparationConstraint (int x, int y, rgbColor c)
 
void AddSeparationConstraint (int which, rgbColor c)
 
void ClearEraserConstraints ()
 
constexpr int GetNumEraserConstraints () const
 
void AddEraserConstraint (int x, int y)
 
void AddEraserConstraint (int which)
 
void ClearTetrisConstraints ()
 
void AddNegativeTetrisConstraint (int x, int y, int which)
 
void AddTetrisConstraint (int x, int y, int which)
 
void AddNegativeTetrisConstraint (int loc, int which)
 
void AddTetrisConstraint (int loc, int which)
 
void ClearStarConstraints ()
 
void AddStarConstraint (int x, int y, rgbColor c)
 
void AddStarConstraint (int which, rgbColor c)
 
void AddRegionConstraint (int x, int y, const WitnessRegionConstraint &constraint)
 
void AddRegionConstraint (int which, const WitnessRegionConstraint &constraint)
 
 operator std::string () const
 
std::ostream & Serialize (std::ostream &os) const
 
std::istream & Deserialize (std::istream &is)
 
std::string SaveToHashString () const
 
void GetDimensionsFromHashString (const std::string &s, int &w, int &h) const
 
void LoadFromHashString (std::string s)
 
int GetPathIndex (int x, int y) const
 
PathLocation GetPathLocation (int index) const
 
int GetRegionIndex (int x, int y) const
 
int GetRegionFromX (int index) const
 
int GetRegionFromY (int index) const
 
void LabelRegions (const WitnessState< width, height > &s) const
 
bool RecursivelyPlacePieces (int curr, uint64_t board, uint64_t oob, uint64_t posFootprint, uint64_t negFootprint) const
 
void GetMouseActions (const WitnessState< width, height > &nodeID, std::vector< WitnessAction > &actions) const
 
void DoLine (Graphics::Display &display, const Graphics::point &p1, const Graphics::point &p2, const rgbColor &c) const
 
Graphics::point GetScreenCoord (int x, int y) const
 
void DebugPrint (uint64_t val, int offset=0) const
 
- Public Member Functions inherited from SearchEnvironment< WitnessState< width, height >, WitnessAction >
virtual ~SearchEnvironment ()
 
virtual void GetSuccessors (const WitnessState< width, height > &nodeID, std::vector< WitnessState< width, height > > &neighbors) const=0
 
virtual int GetNumSuccessors (const WitnessState< width, height > &stateID) const
 
virtual WitnessAction GetAction (const WitnessState< width, height > &s1, const WitnessState< width, height > &s2) const
 
virtual void GetNextState (const WitnessState< width, height > &s1, WitnessAction a, WitnessState< width, height > &s2) const
 
virtual void StoreGoal (WitnessState< width, height > &s)
 Stores the goal for use by single-state HCost. More...
 
virtual void ClearGoal ()
 Clears the goal from memory. More...
 
virtual bool IsGoalStored () const
 Returns true if the goal is stored and false otherwise. More...
 
virtual double HCost (const WitnessState< width, height > &node1, const WitnessState< width, height > &node2, double parentHCost) const
 
virtual double HCost (const WitnessState< width, height > &node) const
 Heuristic value between node and the stored goal. More...
 
virtual uint64_t GetMaxHash () const
 
virtual double GetPathLength (std::vector< WitnessState< width, height > > &neighbors)
 
virtual double GetPathLength (const WitnessState< width, height > &start, std::vector< WitnessAction > &neighbors)
 
virtual OccupancyInterface< WitnessState< width, height >, WitnessAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< WitnessState< width, height >, WitnessAction > *)
 
virtual void OpenGLDraw () const
 
virtual void GLDrawPath (const std::vector< WitnessState< width, height > > &x) const
 
virtual void SetColor (const rgbColor &r) const
 
virtual void SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const
 
virtual void GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const
 
virtual rgbColor GetColor () const
 
virtual void DrawLine (Graphics::Display &display, const WitnessState< width, height > &x, const WitnessState< width, height > &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< WitnessState< width, height > >
 Heuristic ()
 
virtual ~Heuristic ()
 

Static Public Member Functions

static constexpr int GetNumPathConstraints ()
 
static constexpr int GetNumTriangleConstraints ()
 
static constexpr int GetNumSeparationConstraints ()
 
static constexpr int GetNumTetrisConstraints ()
 
static constexpr int GetNumStarConstraints ()
 

Public Attributes

std::array< WitnessPathConstraintType, Witness< width, height >::GetNumPathConstraints()> pathConstraints
 
std::array< std::pair< Graphics::point, Graphics::rect >, Witness< width, height >::GetNumPathConstraints()> pathConstraintLocations
 
std::array< std::array< WitnessRegionConstraint, height >, widthregionConstraints
 
std::array< int,(int) kRegionConstraintCountconstraintCount
 
std::array< std::pair< Graphics::point, Graphics::rect >, width *heightregionConstraintLocations
 
const uint16_t tetrisBits [25]
 
const uint64_t tetrisBits64 [25]
 
const uint16_t tetrisSize [25] = {0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}
 
const uint16_t tetrisWH [25][2]
 
std::vector< std::pair< int, int > > start
 
std::vector< std::pair< int, int > > goal
 
std::array< int,(width+1) *(height+1)> goalMap
 
const rgbColor tetrisYellow = {0.862745098f, 0.6549019608f, 0.0f}
 
const rgbColor tetrisBlue = {0.2196078431f, 0.3607843137f, 0.8705882353f}
 
const rgbColor drawColor = Colors::darkbluegray
 
const rgbColor lineColor = Colors::lightgray
 
const rgbColor backColor = Colors::white
 
const rgbColor outerBackColor = Colors::white
 
const rgbColor triangleColor = Colors::orange
 
float scale = 0.75f
 
float gapOffset = scale * 2.0f / (width > height ? width : height)
 
float lineWidth = gapOffset * 0.1f
 
float xGap = (((width > height) ? (width) : (height)) - width) * gapOffset / 2.0f
 
float yGap = -(((width > height) ? (width) : (height)) - height) * gapOffset / 2.0f
 
std::array< int, width *heightregions
 
std::vector< std::vector< int > * > regionList
 
vectorCache< int > regionCache
 
std::vector< int > tetrisBlockCount
 
std::vector< int > tetrisBlocksInRegion
 
- Public Attributes inherited from Heuristic< WitnessState< width, height > >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 

Additional Inherited Members

- Protected Attributes inherited from SearchEnvironment< WitnessState< width, height >, WitnessAction >
bool bValidSearchGoal
 
WitnessState< width, heightsearchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

template<int width, int height>
class Witness< width, height >

Definition at line 221 of file Witness.h.

Member Enumeration Documentation

◆ legality

template<int width, int height>
enum Witness::legality
Enumerator
kLegal 
kNotAtEnd 
kNotAtStart 
kNotValidAction 
kHitCannotCross 
kHitStart 
kHitLine 

Definition at line 223 of file Witness.h.

Constructor & Destructor Documentation

◆ Witness() [1/2]

template<int width, int height>
Witness< width, height >::Witness ( )
inline

Definition at line 279 of file Witness.h.

References height, Witness< width, height >::Reset(), and width.

◆ Witness() [2/2]

template<int width, int height>
Witness< width, height >::Witness ( const Witness< width, height > &  w)
inline

Definition at line 288 of file Witness.h.

Member Function Documentation

◆ AddCannotCrossConstraint() [1/3]

template<int width, int height>
void Witness< width, height >::AddCannotCrossConstraint ( bool  horiz,
int  x,
int  y 
)

Definition at line 2343 of file Witness.h.

References height, and width.

◆ AddCannotCrossConstraint() [2/3]

template<int width, int height>
void Witness< width, height >::AddCannotCrossConstraint ( int  x,
int  y 
)

Definition at line 2353 of file Witness.h.

References height, and width.

◆ AddCannotCrossConstraint() [3/3]

template<int width, int height>
void Witness< width, height >::AddCannotCrossConstraint ( int  which)

Definition at line 2359 of file Witness.h.

References kCannotCross.

◆ AddEraserConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddEraserConstraint ( int  which)
inline

◆ AddEraserConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddEraserConstraint ( int  x,
int  y 
)
inline

◆ AddGoal()

template<int width, int height>
bool Witness< width, height >::AddGoal ( int  x,
int  y 
)
inline

◆ AddMustCrossConstraint() [1/3]

template<int width, int height>
void Witness< width, height >::AddMustCrossConstraint ( bool  horiz,
int  x,
int  y 
)

Definition at line 2153 of file Witness.h.

References height, and width.

◆ AddMustCrossConstraint() [2/3]

template<int width, int height>
void Witness< width, height >::AddMustCrossConstraint ( int  x,
int  y 
)

Definition at line 2163 of file Witness.h.

References height, and width.

◆ AddMustCrossConstraint() [3/3]

template<int width, int height>
void Witness< width, height >::AddMustCrossConstraint ( int  which)

Definition at line 2189 of file Witness.h.

References kMustCross.

◆ AddNegativeTetrisConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddNegativeTetrisConstraint ( int  loc,
int  which 
)
inline

◆ AddNegativeTetrisConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddNegativeTetrisConstraint ( int  x,
int  y,
int  which 
)
inline

◆ AddRegionConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddRegionConstraint ( int  which,
const WitnessRegionConstraint constraint 
)
inline

◆ AddRegionConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddRegionConstraint ( int  x,
int  y,
const WitnessRegionConstraint constraint 
)
inline

◆ AddSeparationConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddSeparationConstraint ( int  which,
rgbColor  c 
)
inline

◆ AddSeparationConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddSeparationConstraint ( int  x,
int  y,
rgbColor  c 
)
inline

◆ AddStarConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddStarConstraint ( int  which,
rgbColor  c 
)
inline

◆ AddStarConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddStarConstraint ( int  x,
int  y,
rgbColor  c 
)
inline

◆ AddStart()

template<int width, int height>
void Witness< width, height >::AddStart ( int  x,
int  y 
)
inline

Definition at line 455 of file Witness.h.

References Witness< width, height >::start.

Referenced by Witness< width, height >::Deserialize().

◆ AddTetrisConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddTetrisConstraint ( int  loc,
int  which 
)
inline

◆ AddTetrisConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddTetrisConstraint ( int  x,
int  y,
int  which 
)
inline

◆ AddTriangleConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::AddTriangleConstraint ( int  which,
int  count 
)
inline

Definition at line 584 of file Witness.h.

References Witness< width, height >::AddTriangleConstraint(), and width.

◆ AddTriangleConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::AddTriangleConstraint ( int  x,
int  y,
int  count 
)
inline

◆ ApplyAction() [1/2]

template<int width, int height>
void Witness< width, height >::ApplyAction ( std::pair< int, int > &  s,
WitnessAction  a 
) const

Definition at line 1423 of file Witness.h.

References kDown, kEnd, kLeft, kRight, kStart, and kUp.

◆ ApplyAction() [2/2]

template<int width, int height>
void Witness< width, height >::ApplyAction ( WitnessState< width, height > &  s,
WitnessAction  a 
) const
virtual

◆ ClearCannotCrossConstraint()

template<int width, int height>
void Witness< width, height >::ClearCannotCrossConstraint ( int  which)

Definition at line 2300 of file Witness.h.

References kNoPathConstraint.

◆ ClearConstraint()

template<int width, int height>
void Witness< width, height >::ClearConstraint ( WitnessRegionConstraintType  t)
inline

◆ ClearEraserConstraints()

template<int width, int height>
void Witness< width, height >::ClearEraserConstraints ( )
inline

Definition at line 615 of file Witness.h.

References Witness< width, height >::ClearConstraint(), and kEraser.

◆ ClearInnerConstraints()

template<int width, int height>
void Witness< width, height >::ClearInnerConstraints ( )
inline

◆ ClearMustCrossConstraint()

template<int width, int height>
void Witness< width, height >::ClearMustCrossConstraint ( int  which)

Definition at line 2130 of file Witness.h.

References kNoPathConstraint.

◆ ClearPathConstraints()

template<int width, int height>
void Witness< width, height >::ClearPathConstraints ( )
inline

Definition at line 484 of file Witness.h.

References kNoPathConstraint, and Witness< width, height >::pathConstraints.

◆ ClearSeparationConstraints()

template<int width, int height>
void Witness< width, height >::ClearSeparationConstraints ( )
inline

Definition at line 591 of file Witness.h.

References Witness< width, height >::ClearConstraint(), and kSeparation.

◆ ClearStarConstraints()

template<int width, int height>
void Witness< width, height >::ClearStarConstraints ( )
inline

Definition at line 774 of file Witness.h.

References Witness< width, height >::ClearConstraint(), and kStar.

◆ ClearTetrisConstraints()

template<int width, int height>
void Witness< width, height >::ClearTetrisConstraints ( )
inline

Definition at line 692 of file Witness.h.

References Witness< width, height >::ClearConstraint(), kNegativeTetris, and kTetris.

◆ ClearTriangleConstraints()

template<int width, int height>
void Witness< width, height >::ClearTriangleConstraints ( )
inline

Definition at line 562 of file Witness.h.

References Witness< width, height >::ClearConstraint(), and kTriangle.

◆ Click()

template<int width, int height>
bool Witness< width, height >::Click ( Graphics::point  mouseLoc,
InteractiveWitnessState< width, height > &  ws 
)

◆ DebugPrint()

template<int width, int height>
void Witness< width, height >::DebugPrint ( uint64_t  val,
int  offset = 0 
) const
inline

Definition at line 1300 of file Witness.h.

◆ Deserialize()

template<int width, int height>
std::istream& Witness< width, height >::Deserialize ( std::istream &  is)
inline

◆ DoLine()

template<int width, int height>
void Witness< width, height >::DoLine ( Graphics::Display display,
const Graphics::point p1,
const Graphics::point p2,
const rgbColor c 
) const
inline

◆ Draw() [1/3]

template<int width, int height>
void Witness< width, height >::Draw ( Graphics::Display display) const
virtual

◆ Draw() [2/3]

template<int width, int height>
void Witness< width, height >::Draw ( Graphics::Display display,
const InteractiveWitnessState< width, height > &  iws 
) const

◆ Draw() [3/3]

template<int width, int height>
void Witness< width, height >::Draw ( Graphics::Display display,
const WitnessState< width, height > &  s 
) const
virtual

◆ DrawRegionConstraint()

template<int width, int height>
void Witness< width, height >::DrawRegionConstraint ( Graphics::Display display,
const WitnessRegionConstraint constraint,
const Graphics::point p3 
) const

◆ GCost() [1/2]

template<int width, int height>
double Witness< width, height >::GCost ( const WitnessState< width, height > &  node,
const WitnessAction act 
) const
virtual

◆ GCost() [2/2]

template<int width, int height>
double Witness< width, height >::GCost ( const WitnessState< width, height > &  node1,
const WitnessState< width, height > &  node2 
) const
virtual

◆ GetActionHash()

template<int width, int height>
uint64_t Witness< width, height >::GetActionHash ( WitnessAction  act) const
virtual

◆ GetActions()

template<int width, int height>
void Witness< width, height >::GetActions ( const WitnessState< width, height > &  nodeID,
std::vector< WitnessAction > &  actions 
) const
virtual

◆ GetCannotCrossConstraint() [1/3]

template<int width, int height>
bool Witness< width, height >::GetCannotCrossConstraint ( bool  horiz,
int  x,
int  y 
) const

Definition at line 2333 of file Witness.h.

References height, and width.

◆ GetCannotCrossConstraint() [2/3]

template<int width, int height>
bool Witness< width, height >::GetCannotCrossConstraint ( int  which) const

Definition at line 2264 of file Witness.h.

References kCannotCross.

Referenced by Witness< width, height >::SaveToHashString().

◆ GetCannotCrossConstraint() [3/3]

template<int width, int height>
bool Witness< width, height >::GetCannotCrossConstraint ( int  x,
int  y 
) const

Definition at line 2326 of file Witness.h.

References height, and width.

◆ GetDimensionsFromHashString()

template<int width, int height>
void Witness< width, height >::GetDimensionsFromHashString ( const std::string &  s,
int &  w,
int &  h 
) const
inline

Definition at line 1071 of file Witness.h.

Referenced by Witness< width, height >::LoadFromHashString().

◆ GetMaxHash()

template<int width, int height>
uint64_t Witness< width, height >::GetMaxHash

Definition at line 2060 of file Witness.h.

◆ GetMouseActions()

template<int width, int height>
void Witness< width, height >::GetMouseActions ( const WitnessState< width, height > &  nodeID,
std::vector< WitnessAction > &  actions 
) const

◆ GetMustCrossConstraint() [1/3]

template<int width, int height>
bool Witness< width, height >::GetMustCrossConstraint ( bool  horiz,
int  x,
int  y 
) const

Definition at line 2136 of file Witness.h.

References height, and width.

◆ GetMustCrossConstraint() [2/3]

template<int width, int height>
bool Witness< width, height >::GetMustCrossConstraint ( int  which) const

Definition at line 2094 of file Witness.h.

References kMustCross.

Referenced by Witness< width, height >::SaveToHashString().

◆ GetMustCrossConstraint() [3/3]

template<int width, int height>
bool Witness< width, height >::GetMustCrossConstraint ( int  x,
int  y 
) const

Definition at line 2146 of file Witness.h.

References height, and width.

◆ GetNumCannotCrossConstraints()

template<int width, int height>
constexpr int Witness< width, height >::GetNumCannotCrossConstraints
constexpr

Definition at line 2232 of file Witness.h.

References height, and width.

◆ GetNumEraserConstraints()

template<int width, int height>
constexpr int Witness< width, height >::GetNumEraserConstraints ( ) const
inlineconstexpr

Definition at line 618 of file Witness.h.

References height, and width.

◆ GetNumPathConstraints()

template<int width, int height>
constexpr int Witness< width, height >::GetNumPathConstraints
staticconstexpr

◆ GetNumSeparationConstraints()

template<int width, int height>
static constexpr int Witness< width, height >::GetNumSeparationConstraints ( )
inlinestaticconstexpr

Definition at line 594 of file Witness.h.

References height, and width.

◆ GetNumStarConstraints()

template<int width, int height>
static constexpr int Witness< width, height >::GetNumStarConstraints ( )
inlinestaticconstexpr

Definition at line 776 of file Witness.h.

References height, and width.

◆ GetNumTetrisConstraints()

template<int width, int height>
static constexpr int Witness< width, height >::GetNumTetrisConstraints ( )
inlinestaticconstexpr

Definition at line 729 of file Witness.h.

References height, and width.

◆ GetNumTriangleConstraints()

template<int width, int height>
static constexpr int Witness< width, height >::GetNumTriangleConstraints ( )
inlinestaticconstexpr

Definition at line 560 of file Witness.h.

References height, and width.

◆ GetPathIndex()

template<int width, int height>
int Witness< width, height >::GetPathIndex ( int  x,
int  y 
) const
inline

Definition at line 1188 of file Witness.h.

References width.

Referenced by Witness< width, height >::AddGoal().

◆ GetPathLocation()

template<int width, int height>
PathLocation Witness< width, height >::GetPathLocation ( int  index) const
inline

Definition at line 1197 of file Witness.h.

References height, and width.

Referenced by Witness< width, height >::operator std::string().

◆ GetRegionConstraint()

template<int width, int height>
const WitnessRegionConstraint& Witness< width, height >::GetRegionConstraint ( int  x,
int  y 
) const
inline

Definition at line 444 of file Witness.h.

References Witness< width, height >::regionConstraints.

◆ GetRegionFromX()

template<int width, int height>
int Witness< width, height >::GetRegionFromX ( int  index) const
inline

◆ GetRegionFromY()

template<int width, int height>
int Witness< width, height >::GetRegionFromY ( int  index) const
inline

◆ GetRegionIndex()

template<int width, int height>
int Witness< width, height >::GetRegionIndex ( int  x,
int  y 
) const
inline

Definition at line 1214 of file Witness.h.

References width.

◆ GetScreenCoord()

template<int width, int height>
Graphics::point Witness< width, height >::GetScreenCoord ( int  x,
int  y 
) const
inline

◆ GetStateFromHash()

template<int width, int height>
void Witness< width, height >::GetStateFromHash ( uint64_t  parent,
WitnessState< width, height > &  s 
) const
virtual

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 2069 of file Witness.h.

◆ GetStateHash()

template<int width, int height>
uint64_t Witness< width, height >::GetStateHash ( const WitnessState< width, height > &  node) const
virtual

◆ GetSuccessors()

template<int width, int height>
void Witness< width, height >::GetSuccessors ( const WitnessState< width, height > &  nodeID,
std::vector< WitnessState< width, height >> &  neighbors 
) const

Definition at line 1316 of file Witness.h.

◆ GLDrawLine()

template<int width, int height>
void Witness< width, height >::GLDrawLine ( const WitnessState< width, height > &  x,
const WitnessState< width, height > &  y 
) const
inlinevirtual

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 428 of file Witness.h.

◆ GLLabelState()

template<int width, int height>
void Witness< width, height >::GLLabelState ( const WitnessState< width, height > &  ,
const char *   
) const
inlinevirtual

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 427 of file Witness.h.

◆ GoalTest() [1/2]

template<int width, int height>
bool Witness< width, height >::GoalTest ( const WitnessState< width, height > &  node) const
virtual

Goal Test if the goal is stored.

printf("Checking (%d, %d) to (%d, %d) - ", c.location.first, c.location.second, c.location.first+(c.horiz?1:0), c.location.second+(c.horiz?0:1));

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 1743 of file Witness.h.

References height, kEraser, kNegativeTetris, kNoRegionConstraint, kSeparation, kStar, kTetris, kTriangle, numPieces, and width.

◆ GoalTest() [2/2]

template<int width, int height>
bool Witness< width, height >::GoalTest ( const WitnessState< width, height > &  node,
const WitnessState< width, height > &  goal 
) const
virtual

◆ HCost()

template<int width, int height>
double Witness< width, height >::HCost ( const WitnessState< width, height > &  node1,
const WitnessState< width, height > &  node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 1715 of file Witness.h.

◆ InvertAction()

template<int width, int height>
bool Witness< width, height >::InvertAction ( WitnessAction a) const
virtual

◆ LabelRegions()

template<int width, int height>
void Witness< width, height >::LabelRegions ( const WitnessState< width, height > &  s) const

Definition at line 2385 of file Witness.h.

References height, WitnessState< width, height >::OccupiedEdge(), and width.

◆ Legal() [1/2]

template<int width, int height>
bool Witness< width, height >::Legal ( WitnessState< width, height > &  s,
WitnessAction  a 
) const

◆ Legal() [2/2]

template<int width, int height>
bool Witness< width, height >::Legal ( WitnessState< width, height > &  s,
WitnessAction  a,
legality l 
) const

◆ LoadFromHashString()

template<int width, int height>
void Witness< width, height >::LoadFromHashString ( std::string  s)
inline

◆ Move()

template<int width, int height>
void Witness< width, height >::Move ( Graphics::point  mouseLoc,
InteractiveWitnessState< width, height > &  ws 
)

◆ OpenGLDraw() [1/4]

template<int width, int height>
void Witness< width, height >::OpenGLDraw ( ) const
inline

Definition at line 418 of file Witness.h.

◆ OpenGLDraw() [2/4]

template<int width, int height>
void Witness< width, height >::OpenGLDraw ( const WitnessState< width, height > &  ) const
inlinevirtual

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 420 of file Witness.h.

◆ OpenGLDraw() [3/4]

template<int width, int height>
void Witness< width, height >::OpenGLDraw ( const WitnessState< width, height > &  ,
const WitnessAction  
) const
inlinevirtual

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 425 of file Witness.h.

◆ OpenGLDraw() [4/4]

template<int width, int height>
void Witness< width, height >::OpenGLDraw ( const WitnessState< width, height > &  ,
const WitnessState< width, height > &  ,
float   
) const
inlinevirtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< WitnessState< width, height >, WitnessAction >.

Definition at line 423 of file Witness.h.

◆ operator std::string()

template<int width, int height>
Witness< width, height >::operator std::string ( ) const
inline

◆ operator=()

template<int width, int height>
Witness<width, height>& Witness< width, height >::operator= ( const Witness< width, height > &  w)
inline

◆ RecursivelyPlacePieces()

template<int width, int height>
bool Witness< width, height >::RecursivelyPlacePieces ( int  curr,
uint64_t  board,
uint64_t  oob,
uint64_t  posFootprint,
uint64_t  negFootprint 
) const

Definition at line 2014 of file Witness.h.

References height, and width.

◆ RemoveCannotCrossConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::RemoveCannotCrossConstraint ( bool  horiz,
int  x,
int  y 
)

Definition at line 2365 of file Witness.h.

References height, and width.

◆ RemoveCannotCrossConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::RemoveCannotCrossConstraint ( int  x,
int  y 
)

Definition at line 2375 of file Witness.h.

References height, and width.

◆ RemoveMustCrossConstraint() [1/2]

template<int width, int height>
void Witness< width, height >::RemoveMustCrossConstraint ( bool  horiz,
int  x,
int  y 
)

Definition at line 2195 of file Witness.h.

References height, and width.

◆ RemoveMustCrossConstraint() [2/2]

template<int width, int height>
void Witness< width, height >::RemoveMustCrossConstraint ( int  x,
int  y 
)

Definition at line 2226 of file Witness.h.

References height, and width.

◆ RemoveRegionConstraint()

template<int width, int height>
void Witness< width, height >::RemoveRegionConstraint ( int  x,
int  y 
)
inline

◆ Reset()

template<int width, int height>
void Witness< width, height >::Reset ( )
inline

◆ SaveToHashString()

template<int width, int height>
std::string Witness< width, height >::SaveToHashString ( ) const
inline

◆ Serialize()

template<int width, int height>
std::ostream& Witness< width, height >::Serialize ( std::ostream &  os) const
inline

Definition at line 897 of file Witness.h.

Referenced by operator<<().

◆ SetCannotCrossConstraint()

template<int width, int height>
void Witness< width, height >::SetCannotCrossConstraint ( int  which)

◆ SetGoal()

template<int width, int height>
void Witness< width, height >::SetGoal ( int  x,
int  y 
)
inline

◆ SetMustCrossConstraint()

template<int width, int height>
void Witness< width, height >::SetMustCrossConstraint ( int  which)

◆ SetStart()

template<int width, int height>
void Witness< width, height >::SetStart ( int  x,
int  y 
)
inline

Definition at line 449 of file Witness.h.

References Witness< width, height >::start.

◆ UndoAction()

template<int width, int height>
void Witness< width, height >::UndoAction ( WitnessState< width, height > &  s,
WitnessAction  a 
) const
virtual

Member Data Documentation

◆ backColor

template<int width, int height>
const rgbColor Witness< width, height >::backColor = Colors::white

Definition at line 1178 of file Witness.h.

◆ constraintCount

template<int width, int height>
std::array<int, (int)kRegionConstraintCount> Witness< width, height >::constraintCount

◆ drawColor

template<int width, int height>
const rgbColor Witness< width, height >::drawColor = Colors::darkbluegray

Definition at line 1176 of file Witness.h.

◆ gapOffset

template<int width, int height>
float Witness< width, height >::gapOffset = scale * 2.0f / (width > height ? width : height)

Definition at line 1183 of file Witness.h.

Referenced by Witness< width, height >::GetScreenCoord().

◆ goal

template<int width, int height>
std::vector<std::pair<int, int> > Witness< width, height >::goal

◆ goalMap

template<int width, int height>
std::array<int, (width + 1) * (height + 1)> Witness< width, height >::goalMap

◆ lineColor

template<int width, int height>
const rgbColor Witness< width, height >::lineColor = Colors::lightgray

Definition at line 1177 of file Witness.h.

◆ lineWidth

template<int width, int height>
float Witness< width, height >::lineWidth = gapOffset * 0.1f

◆ outerBackColor

template<int width, int height>
const rgbColor Witness< width, height >::outerBackColor = Colors::white

Definition at line 1179 of file Witness.h.

◆ pathConstraintLocations

template<int width, int height>
std::array<std::pair<Graphics::point, Graphics::rect>, Witness<width, height>::GetNumPathConstraints()> Witness< width, height >::pathConstraintLocations

Definition at line 249 of file Witness.h.

Referenced by Witness< width, height >::Reset().

◆ pathConstraints

template<int width, int height>
std::array<WitnessPathConstraintType, Witness<width, height>::GetNumPathConstraints()> Witness< width, height >::pathConstraints

◆ regionCache

template<int width, int height>
vectorCache<int> Witness< width, height >::regionCache
mutable

Definition at line 1229 of file Witness.h.

◆ regionConstraintLocations

template<int width, int height>
std::array<std::pair<Graphics::point, Graphics::rect>, width*height> Witness< width, height >::regionConstraintLocations

Definition at line 277 of file Witness.h.

Referenced by Witness< width, height >::Reset().

◆ regionConstraints

template<int width, int height>
std::array<std::array<WitnessRegionConstraint, height>, width> Witness< width, height >::regionConstraints

◆ regionList

template<int width, int height>
std::vector<std::vector < int> *> Witness< width, height >::regionList
mutable

Definition at line 1228 of file Witness.h.

◆ regions

template<int width, int height>
std::array<int, width * height> Witness< width, height >::regions
mutable

Definition at line 1224 of file Witness.h.

◆ scale

template<int width, int height>
float Witness< width, height >::scale = 0.75f

Definition at line 1182 of file Witness.h.

Referenced by Witness< width, height >::GetScreenCoord().

◆ start

template<int width, int height>
std::vector<std::pair<int, int> > Witness< width, height >::start

◆ tetrisBits

template<int width, int height>
const uint16_t Witness< width, height >::tetrisBits[25]
Initial value:
= {0, 0x8000, 0xC000, 0x8800, 0xC800, 0xC400, 0x8C00, 0x4C00, 0xE000, 0x8880, 0xCC00,
0xE800, 0x8E00, 0xE200, 0x2E00, 0xC880, 0xC440, 0x88C0, 0x44C0, 0xF000, 0x8888,
0xE400, 0x4E00, 0x8C80, 0x4C40}

Definition at line 732 of file Witness.h.

◆ tetrisBits64

template<int width, int height>
const uint64_t Witness< width, height >::tetrisBits64[25]
Initial value:
= {0, 0x8000000000000000ull, 0xC000000000000000ull, 0x8080000000000000ull,
0x80C0000000000000ull, 0x40C0000000000000ull, 0xC080000000000000ull,
0xC040000000000000ull,
0xE000000000000000ull, 0x8080800000000000ull, 0xC0C0000000000000ull,
0x80E0000000000000ull,
0xE080000000000000ull, 0x20E0000000000000ull, 0xE020000000000000ull,
0x8080C00000000000ull,
0x4040C00000000000ull, 0xC080800000000000ull, 0xC040400000000000ull,
0xF000000000000000ull,
0x8080808000000000ull, 0x40E0000000000000ull, 0xE040000000000000ull,
0x80C0800000000000ull,
0x40C0400000000000ull}

Definition at line 735 of file Witness.h.

◆ tetrisBlockCount

template<int width, int height>
std::vector<int> Witness< width, height >::tetrisBlockCount
mutable

Definition at line 1231 of file Witness.h.

◆ tetrisBlocksInRegion

template<int width, int height>
std::vector<int> Witness< width, height >::tetrisBlocksInRegion
mutable

Definition at line 1232 of file Witness.h.

◆ tetrisBlue

template<int width, int height>
const rgbColor Witness< width, height >::tetrisBlue = {0.2196078431f, 0.3607843137f, 0.8705882353f}

Definition at line 1175 of file Witness.h.

Referenced by Witness< width, height >::AddNegativeTetrisConstraint().

◆ tetrisSize

template<int width, int height>
const uint16_t Witness< width, height >::tetrisSize[25] = {0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}

Definition at line 747 of file Witness.h.

◆ tetrisWH

template<int width, int height>
const uint16_t Witness< width, height >::tetrisWH[25][2]
Initial value:
= {{0, 0},
{1, 1},
{2, 1},
{1, 2},
{2, 2},
{2, 2},
{2, 2},
{2, 2},
{3, 1},
{1, 3},
{2, 2},
{3, 2},
{3, 2},
{3, 2},
{3, 2},
{2, 3},
{2, 3},
{2, 3},
{2, 3},
{4, 1},
{1, 4},
{3, 2},
{3, 2},
{2, 3},
{2, 3}}

Definition at line 748 of file Witness.h.

◆ tetrisYellow

template<int width, int height>
const rgbColor Witness< width, height >::tetrisYellow = {0.862745098f, 0.6549019608f, 0.0f}

Definition at line 1174 of file Witness.h.

Referenced by Witness< width, height >::AddTetrisConstraint().

◆ triangleColor

template<int width, int height>
const rgbColor Witness< width, height >::triangleColor = Colors::orange

Definition at line 1180 of file Witness.h.

Referenced by Witness< width, height >::AddTriangleConstraint().

◆ xGap

template<int width, int height>
float Witness< width, height >::xGap = (((width > height) ? (width) : (height)) - width) * gapOffset / 2.0f

Definition at line 1185 of file Witness.h.

Referenced by Witness< width, height >::GetScreenCoord().

◆ yGap

template<int width, int height>
float Witness< width, height >::yGap = -(((width > height) ? (width) : (height)) - height) * gapOffset / 2.0f

Definition at line 1186 of file Witness.h.

Referenced by Witness< width, height >::GetScreenCoord().


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