Skip to content

Commit

Permalink
Revert "fixed #7 (y,x) to (x,y)"
Browse files Browse the repository at this point in the history
This reverts commit b0daa42.
  • Loading branch information
Mooophy committed Sep 14, 2015
1 parent b0daa42 commit 3d42291
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions planning/UnitTests/test_astar_sel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ namespace UnitTests
astar({ "", { 0, 0 }, { 8, 12 } }, validate);

Assert::AreEqual(44u, astar.last_run.max_q_size);
Assert::AreEqual(34u, astar.last_run.expansions.size());
Assert::AreEqual(string{ "788887888688" }, astar.last_run.final_path);
Assert::AreEqual(32u, astar.last_run.expansions.size());
Assert::AreEqual(string{ "588885888838" }, astar.last_run.final_path);
Assert::IsTrue(100 < (int)astar.last_run.run_time && 1000 > (int)astar.last_run.run_time);
Assert::IsTrue(astar.last_run.is_found);
}
Expand Down
12 changes: 6 additions & 6 deletions planning/UnitTests/test_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace UnitTests
auto const c = State{ 1u, 1u };

Assert::IsTrue(State{ 0u, 0u } == GOES.at('1')(c));
Assert::IsTrue(State{ 1u, 0u } == GOES.at('2')(c));
Assert::IsTrue(State{ 2u, 0u } == GOES.at('3')(c));
Assert::IsTrue(State{ 0u, 1u } == GOES.at('4')(c));
Assert::IsTrue(State{ 2u, 1u } == GOES.at('5')(c));
Assert::IsTrue(State{ 0u, 2u } == GOES.at('6')(c));
Assert::IsTrue(State{ 1u, 2u } == GOES.at('7')(c));
Assert::IsTrue(State{ 0u, 1u } == GOES.at('2')(c));
Assert::IsTrue(State{ 0u, 2u } == GOES.at('3')(c));
Assert::IsTrue(State{ 1u, 0u } == GOES.at('4')(c));
Assert::IsTrue(State{ 1u, 2u } == GOES.at('5')(c));
Assert::IsTrue(State{ 2u, 0u } == GOES.at('6')(c));
Assert::IsTrue(State{ 2u, 1u } == GOES.at('7')(c));
Assert::IsTrue(State{ 2u, 2u } == GOES.at('8')(c));
}

Expand Down
24 changes: 12 additions & 12 deletions planning/lib/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ namespace search
//
struct State
{
Integer x, y;
Integer y, x;
auto to_string() const -> string
{
using std::to_string;
return "[" + to_string(x) + "," + to_string(y) + "]";
return "[" + to_string(y) + "," + to_string(x) + "]";
}

auto is_within_grid(State s1, State s2) const -> bool
{
auto xmax = max(s1.x, s2.x);
auto xmin = min(s1.x, s2.x);
auto ymax = max(s1.y, s2.y);
auto ymin = min(s1.y, s2.y);
auto xmax = max(s1.x, s2.x);
auto xmin = min(s1.x, s2.x);

return x >= xmin && x <= xmax && y >= ymin && y <= ymax;
}
Expand All @@ -57,14 +57,14 @@ namespace search
{
Goes()
{
(*this)['1'] = [](State s) -> State { return{ s.x - 1, s.y - 1 }; };
(*this)['2'] = [](State s) -> State { return{ s.x - 0, s.y - 1 }; };
(*this)['3'] = [](State s) -> State { return{ s.x + 1, s.y - 1 }; };
(*this)['4'] = [](State s) -> State { return{ s.x - 1, s.y - 0 }; };
(*this)['5'] = [](State s) -> State { return{ s.x + 1, s.y + 0 }; };
(*this)['6'] = [](State s) -> State { return{ s.x - 1, s.y + 1 }; };
(*this)['7'] = [](State s) -> State { return{ s.x - 0, s.y + 1 }; };
(*this)['8'] = [](State s) -> State { return{ s.x + 1, s.y + 1 }; };
(*this)['1'] = [](State s) -> State { return{ s.y - 1, s.x - 1 }; };
(*this)['2'] = [](State s) -> State { return{ s.y - 1, s.x - 0 }; };
(*this)['3'] = [](State s) -> State { return{ s.y - 1, s.x + 1 }; };
(*this)['4'] = [](State s) -> State { return{ s.y - 0, s.x - 1 }; };
(*this)['5'] = [](State s) -> State { return{ s.y + 0, s.x + 1 }; };
(*this)['6'] = [](State s) -> State { return{ s.y + 1, s.x - 1 }; };
(*this)['7'] = [](State s) -> State { return{ s.y + 1, s.x - 0 }; };
(*this)['8'] = [](State s) -> State { return{ s.y + 1, s.x + 1 }; };
}
} const GOES;
//
Expand Down

0 comments on commit 3d42291

Please sign in to comment.