#include <iostream>
+int Step::count = 0;
signed char Step::adjacent[BOARD_SIZE][5] = {
1, 4, -1, -1, -1,
0, 2, 5, -1, -1,
return dist;
}
-Step::Step(Board board, std::shared_ptr<Step> prev) : board(board), prev(prev) {}
+Step::Step(Board board, std::shared_ptr<Step> prev) : board(board), prev(prev) {
+ count++;
+}
+
+Step::~Step() {
+ count--;
+}
std::vector<std::shared_ptr<Step>> Step::successors(std::shared_ptr<Step> shared_this) const {
std::vector<std::shared_ptr<Step>> suc;
seen.emplace(s->board);
todo.push(s);
if (seen.size() % 10000 == 0) {
- std::cerr << "Examined " << seen.size() << " boards. " << todo.size()
+ std::cerr << "Examined " << seen.size() << " boards. Tracking "
+ << Step::count << " steps. " << todo.size()
<< " waiting. Considering paths of length "
<< todo.top()->cost(invgoal) << std::endl;
}
struct Step {
Step(Board board, std::shared_ptr<Step> prev);
+ ~Step();
Board board;
std::shared_ptr<Step> prev;
int cost(const InvertedBoard& invgoal) const;
static signed char adjacent[BOARD_SIZE][5];
+ static int count;
};
std::ostream& operator<<(std::ostream& os, const Step& step);