Go to the documentation of this file. 1 #ifndef BURNEDPANCAKE_H
2 #define BURNEDPANCAKE_H
14 puzzle.resize(puzzle_size);
15 for (
unsigned int x = 0; x <
puzzle.size(); x++)
23 for (
unsigned int x = 0; x <
loc.puzzle.size(); x++)
25 out <<
loc.puzzle[x] <<
" ";
35 for (
unsigned int x = 0; x < l1.
puzzle.size(); x++)
75 fprintf(stderr,
"ERROR: Call to Get_Goal when no goal stored\n");
118 static std::vector<unsigned>
Get_Puzzle_Order(int64_t order_num,
unsigned num_pancakes);
135 static uint64_t table[21] =
136 { 1ll, 1ll, 2ll, 6ll, 24ll, 120ll, 720ll, 5040ll, 40320ll, 362880ll, 3628800ll, 39916800ll, 479001600ll,
137 6227020800ll, 87178291200ll, 1307674368000ll, 20922789888000ll, 355687428096000ll,
138 6402373705728000ll, 121645100408832000ll, 2432902008176640000ll };
bool InvertAction(unsigned &a) const
std::vector< unsigned > operators
bool IsGoalStored() const
static std::vector< unsigned > Get_Puzzle_Order(int64_t order_num, unsigned num_pancakes)
Returns a possible ordering of the operators.
uint64_t Factorial(int val) const
double GCost(const BurnedPancakePuzzleState &, const unsigned &) const
void Change_Op_Order(const std::vector< unsigned > op_order)
Changes the ordering of operators to the new inputted order.
double HCost(const BurnedPancakePuzzleState &state1, const BurnedPancakePuzzleState &state2) const
Heuristic value between two arbitrary nodes.
double GCost(const BurnedPancakePuzzleState &, const BurnedPancakePuzzleState &) const
BurnedPancakePuzzle(unsigned s)
void GetActions(const BurnedPancakePuzzleState &state, std::vector< unsigned > &actions) const
void OpenGLDraw(const BurnedPancakePuzzleState &, const unsigned &) const
std::vector< unsigned > Get_Op_Order()
std::vector< int > goal_locations
BurnedPancakePuzzleState Get_Goal()
Returns stored goal state if it is stored.
void GetSuccessors(const BurnedPancakePuzzleState &state, std::vector< BurnedPancakePuzzleState > &neighbors) const
void StoreGoal(BurnedPancakePuzzleState &)
Stores the goal for use by single-state HCost.
uint64_t GetActionHash(unsigned act) const
std::vector< int > puzzle
BurnedPancakePuzzleState(unsigned int puzzle_size)
bool GoalTest(const BurnedPancakePuzzleState &state, const BurnedPancakePuzzleState &goal) const
static std::ostream & operator<<(std::ostream &out, const BurnedPancakePuzzleState &loc)
static bool operator==(const BurnedPancakePuzzleState &l1, const BurnedPancakePuzzleState &l2)
BurnedPancakePuzzleState goal
BurnedPancakePuzzleState()
unsigned GetAction(const BurnedPancakePuzzleState &s1, const BurnedPancakePuzzleState &s2) const
void OpenGLDraw(const BurnedPancakePuzzleState &, const BurnedPancakePuzzleState &, float) const
Draw the transition at some percentage 0...1 between two states.
double Memory_Free_HCost(const BurnedPancakePuzzleState &state1, const std::vector< int > &goal_locs) const
void OpenGLDraw(const BurnedPancakePuzzleState &) const
void Set_Use_Memory_Free_Heuristic(bool to_use)
void ClearGoal()
Clears the goal from memory.
virtual uint64_t GetStateHash(const BurnedPancakePuzzleState &s) const
void ApplyAction(BurnedPancakePuzzleState &s, unsigned a) const