Go to the documentation of this file.
26 void AddFling(
unsigned int x,
unsigned int y);
30 bool CanMove(
int which,
int x,
int y)
const;
31 void Move(
int which,
int x,
int y);
37 bool HasHole(
int x,
int y)
const;
46 std::vector<std::pair<int, int>>
locs;
86 for (
unsigned int y= 0; y <
loc.height; y++)
88 for (
unsigned int x = 0; x <
loc.width; x++)
90 if (
loc.HasPiece(x, y))
94 else if (
loc.HasHole(x, y))
98 else if (
loc.HasObstacle(x, y))
113 out << +
loc.startLoc <<
"->";
116 case kLeft: out <<
"Left";
break;
117 case kRight: out <<
"Right";
break;
118 case kUp: out <<
"Up";
break;
119 case kDown: out <<
"Down";
break;
181 int64_t
binomialSum(
unsigned int n1,
unsigned int n2,
unsigned int k);
183 int64_t
binomial(
unsigned int n,
unsigned int k);
184 int64_t
bi(
unsigned int n,
unsigned int k);
213 std::size_t hash = 0;
214 for (
unsigned int x = 0; x <
node.locs.size(); x++)
216 hash |= (1ull<<
node.locs[x].first);
bool HasHole(int x, int y) const
void Move(int which, int x, int y)
bool GetXYFromPoint(const FlingBoard &b, point3d loc, int &x, int &y) const
uint64_t GetRawObstacles() const
virtual void UndoAction(FlingBoard &s, FlingMove a) const
std::vector< int64_t > binomials
virtual void OpenGLDraw() const
int GetIndexInLocs(int x, int y) const
static bool operator==(const FlingBoard &l1, const FlingBoard &l2)
int64_t getMaxSinglePlayerRank2(int spots, int numPieces)
FlingBoard(unsigned int len=7, unsigned int high=8)
void SetObstacle(int which)
virtual void ApplyAction(FlingBoard &s, FlingMove a) const
void ClearHole(int which)
std::size_t operator()(const FlingBoard &node) const
virtual uint64_t GetActionHash(FlingMove act) const
int LocationAfterAction(FlingMove m)
static std::ostream & operator<<(std::ostream &out, const FlingBoard &loc)
int64_t binomial(unsigned int n, unsigned int k)
static bool operator!=(const FlingBoard &l1, const FlingBoard &l2)
virtual uint64_t GetStateHash(const FlingBoard &node) const
void IncrementRank(FlingBoard &b) const
uint64_t GetRawHoles() const
uint64_t GetRawBoard() const
bool CanMove(int which, int x, int y) const
void GetMirror(const FlingBoard &in, FlingBoard &out, bool horiz, bool vert)
int64_t getMaxSinglePlayerRank(int spots, int numPieces)
bool unrankPlayer(int64_t theRank, int pieces, FlingBoard &s)
virtual FlingMove GetAction(const FlingBoard &s1, const FlingBoard &s2) const
virtual void OpenGLDrawPlain(const FlingBoard &b) const
virtual bool GoalTest(const FlingBoard &node, const FlingBoard &goal) const
int64_t rankPlayer(FlingBoard &s)
bool HasPiece(int x, int y) const
std::vector< int64_t > theSums
virtual double HCost(const FlingBoard &node1, const FlingBoard &node2) const
Heuristic value between two arbitrary nodes.
void AddFling(unsigned int x, unsigned int y)
void SetGoalPanda(int which)
virtual void GLLabelState(const FlingBoard &, const char *) const
int64_t binomialSum(unsigned int n1, unsigned int n2, unsigned int k)
virtual double GCost(const FlingBoard &node1, const FlingBoard &node2) const
bool LegalMove(const FlingBoard &, FlingMove)
virtual void GetSuccessors(const FlingBoard &nodeID, std::vector< FlingBoard > &neighbors) const
virtual void GetStateFromHash(uint64_t parent, FlingBoard &s) const
virtual double GCost(const FlingBoard &node, const FlingMove &act) const
int GetPieceLocation(int which) const
uint64_t GetCanonicalHash(uint64_t which)
std::vector< std::pair< int, int > > locs
void SetObstacles(uint64_t o)
bool HasObstacle(int x, int y) const
void rankPlayerFirstTwo(FlingBoard &s, int64_t &index1)
void RemoveFling(unsigned int x, unsigned int y)
virtual void GetNextState(const FlingBoard &, FlingMove, FlingBoard &) const
void rankPlayerRemaining(FlingBoard &s, int64_t &index2)
virtual void GetActions(const FlingBoard &nodeID, std::vector< FlingMove > &actions) const
virtual void OpenGLDrawAlternate(const FlingBoard &) const
void ClearPiece(int which)
void ClearObstacle(int which)
void ShiftToCorner(FlingBoard &in)
virtual bool InvertAction(FlingMove &a) const
int64_t bi(unsigned int n, unsigned int k)
Nodes to be stored within a Graph.