summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-12-08 15:02:25 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-12-15 13:34:36 +0100
commitcd4b8540d7c7a4fc9f75659255110c250174e7f0 (patch)
treef5bc270deb6a65ee015a281a952b1de64114a265
parentf41f0fdb066629597529ba12329d22040ce2878c (diff)
downloadtddd86-cd4b8540d7c7a4fc9f75659255110c250174e7f0.tar.gz
l8 remove logs
-rwxr-xr-xlabb8/src/trailblazer.cpp18
1 files changed, 0 insertions, 18 deletions
diff --git a/labb8/src/trailblazer.cpp b/labb8/src/trailblazer.cpp
index 6d10bd3..c8496f9 100755
--- a/labb8/src/trailblazer.cpp
+++ b/labb8/src/trailblazer.cpp
@@ -24,7 +24,6 @@ vector<Node*> path_from_end(Node* end, bool color_green = false) {
cur = cur->previous;
}
reverse(path.begin(), path.end());
- cout << "done" << endl;
return path;
}
@@ -122,9 +121,6 @@ vector<Node*> dijkstrasAlgorithm(BasicGraph& graph, Vertex* start, Vertex* end)
}
vector<Node*> aStar(BasicGraph& graph, Vertex* start, Vertex* end) {
- ofstream log;
- log.open("log");
- log << "reset" << endl;
graph.resetData();
PriorityQueue<Node *> q;
@@ -132,42 +128,28 @@ vector<Node*> aStar(BasicGraph& graph, Vertex* start, Vertex* end) {
start->visited = true;
while (q.size() > 0) {
- log << q << endl;
Node* cur = q.dequeue();
- log << cur << endl;
cur->visited = true;
- log << "green" << endl;
cur->setColor(GREEN);
- log << "green done" << endl;
if (cur == end) {
- log << "done" << endl;
break;
}
for (const auto& arc : cur->arcs) {
- log << arc << " " << *arc << endl;
if (!arc->finish->visited) {
double new_dist = arc->start->cost + arc->cost;
if (arc->finish->cost == 0.0) {
- log << "first" << endl;
arc->finish->previous = cur;
arc->finish->cost = new_dist;
- log << "yellow" << endl;
arc->finish->setColor(YELLOW);
- log << "yellow done" << endl;
- log << "queing" << endl;
q.enqueue(arc->finish, new_dist + arc->finish->heuristic(end));
}
else if (new_dist < arc->finish->cost) {
- log << "new best" << endl;
arc->finish->previous = cur;
arc->finish->cost = new_dist;
- log << "change prio" << endl;
q.changePriority(arc->finish, new_dist + arc->finish->heuristic(end));
}
}
- log << "done considering" << endl;
}
}
- log.close();
return path_from_end(end);
}