Make AStar to use 64-bit logic

This commit is contained in:
Yuri Rubinsky
2022-06-16 11:56:12 +03:00
parent 1ad6fade00
commit 7da2a21425
5 changed files with 146 additions and 151 deletions

View File

@ -58,7 +58,7 @@ public:
}
// Disable heuristic completely.
real_t _compute_cost(int p_from, int p_to) {
real_t _compute_cost(int64_t p_from, int64_t p_to) {
if (p_from == A && p_to == C) {
return 1000;
}
@ -68,7 +68,7 @@ public:
TEST_CASE("[AStar3D] ABC path") {
ABCX abcx;
Vector<int> path = abcx.get_id_path(ABCX::A, ABCX::C);
Vector<int64_t> path = abcx.get_id_path(ABCX::A, ABCX::C);
REQUIRE(path.size() == 3);
CHECK(path[0] == ABCX::A);
CHECK(path[1] == ABCX::B);
@ -77,7 +77,7 @@ TEST_CASE("[AStar3D] ABC path") {
TEST_CASE("[AStar3D] ABCX path") {
ABCX abcx;
Vector<int> path = abcx.get_id_path(ABCX::X, ABCX::C);
Vector<int64_t> path = abcx.get_id_path(ABCX::X, ABCX::C);
REQUIRE(path.size() == 4);
CHECK(path[0] == ABCX::X);
CHECK(path[1] == ABCX::A);
@ -318,7 +318,7 @@ TEST_CASE("[Stress][AStar3D] Find paths") {
for (int u = 0; u < N; u++) {
for (int v = 0; v < N; v++) {
if (u != v) {
Vector<int> route = a.get_id_path(u, v);
Vector<int64_t> route = a.get_id_path(u, v);
if (!Math::is_inf(d[u][v])) {
// Reachable.
if (route.size() == 0) {