Skip to content

Commit

Permalink
day 21 example input correcdt
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Dec 25, 2024
1 parent ff5e638 commit 3dc2070
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions 2024/src/day21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ std::map<std::pair<Pos, Pos>, std::string> numeric_shortest_paths = {

{{_numA, _9}, "^^^"}, {{_numA, _8}, "<^^^"}, {{_numA, _7}, "^^^<<"},
{{_numA, _6}, "^^"}, {{_numA, _5}, "<^^"}, {{_numA, _4}, "^^<<"},
{{_numA, _3}, "^"}, {{_numA, _2}, "<^"}, {{_numA, _1}, "^<<<"},
{{_numA, _3}, "^"}, {{_numA, _2}, "<^"}, {{_numA, _1}, "^<<"},
{{_numA, _0}, "<"}
};

Expand Down Expand Up @@ -123,14 +123,13 @@ std::map<std::pair<Pos, Pos>, std::string> directional_shortest_paths = {
};

std::string get_path(std::string path, std::map<char, Pos> char_to_pos, std::map<std::pair<Pos, Pos>, std::string> shortest_path, std::vector<std::string> keypad) {
Pos start = char_to_pos['A'];
std::string output_path = "";
Pos current = start;
Pos current = char_to_pos['A'];
for (char c : path) {
Pos next = char_to_pos[c];
output_path += shortest_path[{current, next}];
output_path.push_back('A');
std::cout << std::format("-- moving from ({}) to ({}) :: {}", keypad[current.y][current.x], keypad[next.y][next.x], output_path) << std::endl;
// std::cout << std::format("-- moving from ({}) to ({}) :: {}", keypad[current.y][current.x], keypad[next.y][next.x], output_path) << std::endl;
current = next;
}
return output_path;
Expand Down

0 comments on commit 3dc2070

Please sign in to comment.