partial solutoon

main
Brett 2024-12-06 13:53:20 -05:00
parent d5886e292a
commit 7cc98681ae
12 changed files with 2250 additions and 1 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.29)
project(Advent-Of-Code-2024 VERSION 0.0.3)
project(Advent-Of-Code-2024 VERSION 0.0.4)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)

24
include/day4.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
/*
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef DAY4_H
#define DAY4_H
void run_day4();
#endif //DAY4_H

24
include/day5.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
/*
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef DAY5_H
#define DAY5_H
void run_day5();
#endif //DAY5_H

24
include/day6.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
/*
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef DAY6_H
#define DAY6_H
void run_day6();
#endif //DAY6_H

140
problems/day4/input Normal file
View File

@ -0,0 +1,140 @@
SMMMSMSMSSSMSSSXAMXXAASXMMSMXMAMSSSXSAMSAMXSXSSSMXMAXASXSASXSXMXSMSMSXSMMMMAMMXXSMMMSXSXXAMXMAMASMSMSSMMMMSAMXXMXMASMMMAMXSSMXAMXMASMSMSMSAA
XAAAAXAAMAAAAAMMXXMASASAMAAXMXSMAAMASXMSXSXMAXAAXSMSXXMASAMSXAMAMAMASXSXSASAMSAMXAAXSSMXASXSXXMMSAXAAAAAMAMXXAXMASMSAMXAMXMASXSAXSASXAAAAMMM
SSMSSSMSMSMMMSXASMAXMASXMXSSMAMMMMMAMAAMMMAMMMMMMSAAXMMMMMMAMAMAMAMXMAMASAMASAMXSSMMMASMMMAXAXSAMXMMMXAMSSMSMAXXMAXMASMSSMMAMMMAMMASMMMMXMAM
XMAMXAAXAAAMXXASAXSXMXMASAAXMASXXXMXXMMXASAMAAXXAMMMMMAMAMXMSXMASASAMXMAMAMMMMMMXMSMSAMSAMXMMMSAMMAMXXSMMAASMMMMXMAXAMXXAMSASAMAMMAMAXAXASMS
XMAMSMMMSMSMAMMXMAMXSAXAMMSMMASMMMMSXAMSXSASMSSMMMMAAXAXASAXAXMMSMSASMMASAXAAAAAAMAXMAMMMXAAAXMAXSAMXXXAMMMMAAXXAXXMMMXMAMXAXMXASMMSXSXSASAA
XXAXMMMAXXXMXSAMXMMASXSXMAMAMAXAXAAXMAMSAMXMAMXXAASMSSSSXSMSMMSMSAMAMASXSASXSMSSMSAMMXMAMSSMMMSAMASXSXSAMXASMMSMSSMXSAMXSMSMMSSMMAAXXAMXMMMM
MSMSAAMSSMXSXM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MMMSXSAMASMSMSAASMMSASXSASASASMASAMXMSSSMAAMXXSAMMMSSMM
MMMMAMAMSMSMSMSASMSMMMMMMAMMMSMSASMMASMAMXSMMXMXMXMSSMSMASXMAMXMMMXSMMMXXXXAXXSXMXXMAASAMXMASAXAMXMXMXAAXAXXMAMXSAMMMXAXMMAAXSAMXMASASAAAAAX
SASMSMXXAMAAAAAAMAXAAAAXSSSSMAAMASMSASMASAAAAMMAMAXXAMMMASASXSMSMSASAASMMMMSMMMAMXMMSMMAMMSMMMSSMSMSMSMMMMMSMAMAMASAMXSMSMMSMSMSSMMSAMMMSSMM
MASAAAXSASMSMSMMMXMSMSSXXXMASMSMMMAMAXMASMSMMXSASMSSMMXMASXMASAAAMASXMAASAAAMASAMAXMAMSAMAAAAAXAASAAMAAAASAASAMXSASASAAAAASAASAAXAXMXMXAAMAS
MMMMMMMSMMXAAXXMMXAXMAXASMSAMMAAXMXMXMMMSMXMAMSXSMXAXSXSAMXXAMMMSMMMMSSSMMSSSXSSSXSXMASMSSSSMSSMMMSMSSSSSSSXSSSXMASAMMSMSSMMSMMMSAMXAXAMMSAM

28
problems/day5/example Normal file
View File

@ -0,0 +1,28 @@
47|53
97|13
97|61
97|47
75|29
61|13
75|53
29|13
97|29
53|29
61|53
97|53
61|29
47|13
75|47
97|75
47|61
75|61
47|29
75|13
53|13
75,47,61,53,29
97,61,53,29,13
75,29,13
75,97,47,61,53
61,13,29
97,13,75,29,47

1366
problems/day5/input Normal file

File diff suppressed because it is too large Load Diff

130
problems/day6/input Normal file
View File

@ -0,0 +1,130 @@
...#........................................#........#.................#............#.#.......................#...............#..#
...#........#.....#..................................................................................#......#..#..................
.................#.......................#.#........#......#...........................................#...#..........#...........
..................#..................#...#.....................................#........#.........................................
...#.....#.......#..............#.#....##.............#....##......................................#...................#..........
...#..........................................................................................................................#...
..#..#.............#.....#...............#.......#..............................................#....#............................
......................#..#...............#...................#....#..........................#...#............#...#....##.........
..#.#.........#................#............#............#.#.......#................#....#..#.....................................
.......................................................................#.....................................#...........#........
...........#.....................................................................#.................................#......#.......
...#.........#....................................................#..............#.............#..........#.......................
.................................................................................................#................................
..................................#.#.#...#.......#.............#.......................#..#.......................#.#............
.......................#.........................................#..........#...#.....#....................................#......
.......#.......#.#...........#......................#.....#..#...#.#...............#.............................#...#............
............##...#......#.........#......#............................................................#.........#..............#..
..#........................................#........##..#...............................................................#.........
...........#..............##................................................................................#.....................
..#................................................................................#..............#...............................
...................................##..............#..........................#.......#..#...............#........#...............
....#............#.........................#................................................................#........#............
............#.....................................................................#.............................................#.
............#..........#.......#...........#.#......#..............#.........#.......................................#......#.....
..#...............................................#..................................#.............................#.............#
.........................................................................#........#................#......#.......#....#........#.
.......................................................................#.....##.................................................#.
..............#.............#...........................#...#..#....................................................#.............
.......#..........................#.......................###..................................#.....................#..#.........
................#.................#.............#......................................................................#........#.
.#.....#................#......................................................................#................#.................
................................#........................#........#..#........................#...................................
..............................................................................................#.....................#.........#...
..................#.................#.........................#.....#................#............................................
......#...................#...#...................#..................#...........................#......###...................#...
.............................##.....#..............#..............................................................#....#..........
......#..................#....................................................###....................#..............#.............
............#...#..................#........#.............#..............................#.........#..........................#...
....#...............................#......#......#...............#.#......#............#...................................#.....
.......#...................................#.#.#.........................................................#..................#.....
.....................#.......#.#......#.#.....................#...................................................................
......#.....#............................................................................#............#.......#..#................
..........#.#......#...................................#....#.#............##.....................................................
...............#........................#..................................#...........#...................................#......
.#....................................................#.......................................................................#...
......#.........................................#...#.........................................#........#..........................
.........................................#..........#.............................................................................
...................#.....................................#.....................#..#............#....#........................##...
.................................#.........#.............#.............................#...........................#...#..........
..#................................................................#.....#....#.................................#.................
........#................#............#.#..........................................#..............................................
..#...........##.....................#..#..........................#...#...#....#.................................................
................................................................................#.................................................
............#...........#.........#....#.........................................................................#................
.............................#...........................................#...............##...................................#...
......................#..............#...#........................#........................................#......................
............#..............#...#.....#.....#..........#...........................#........#...............#......................
..................#............................#....#................................................................#............
..#........................#.............................#......#...............#....#...........#................................
.................................................#................................................#..................#........#...
.#......#.........................................................#...........#...#.......................#.......................
..........................................#.......##........#................................................#..##............##..
..............#...#....................................................................#........#...........................#.....
................#....................................................................#........................................###.
....#............................................#........................#.................#........#.....#...#.....#.#....#.....
...##..........#..................................................................................................................
#....#.........#....................#.#.........................#..........##.......#....#..#....................#................
........#.........#..........#.................#..................#................................#.......#................#...#.
.#..........................................#..#..#......#................................#.#.#..#................................
....#.......#.........#............................................................#....#.........................................
.....................................................................#...#......................#.................................
............#.....#.....#..........#...............................................................................#..............
.........................#...#.#.......#....................................................................#.................#...
......................................................#.#..........................#...#................#.........................
.....#.........#.........#..............................................................#...................#.#......#............
.......................................#......#.......................#.................................................#.....#...
.....#....#.......................................................................................................................
#..........#....#....................................#.............#...............#...................#..........#...............
..#....................................##.....................................#...............................#...................
....#..................................#........................#.................................................................
....#................................................................................................#...................#........
....#................................................................................#............................................
..........#.....#...................#.......................#......#..............................................................
#...................#..........#............................................................#............#..............#.........
...#...#....#................................#............................#.##.....................................#..............
..........#.........#.....#...........#............................#...............#.#....#................#....................##
.....#...................................................#........................................................................
............##....................................#..................#.#..#.....................#.........#....##......#...#......
...........#.......#....................#.......................#..#.................#.......#.........#..........................
#.....................#..#..............................................................................................#.........
....#....#..............#............##....................................................^.................#..............#.....
.........#......................................................#..............#............#...#......#....#.....................
.......##...................#...........#.........#.......................................#..........................#............
.#........#.#........................#...........#............#..#........#........#.............#................................
..................##........##.................................................................................#................#.
...#...................#.....#...........#.........#..#............#..................................#.....#.....................
.................#.........#..........#............#......#.........................#.............#.......#......................#
.................................................................#...............#.....#.#....#...................................
..........................#...........................................................................................#..#........
..............#.................................................................................##......................#.........
....#...#....................#...............................................#................#............#......................
........................................................................#........#................................................
....#.....#......................#.......#............#......................................#..................................#.
................#................................#.#.............#.#.........#..............................................#.....
..............#..................#...#...........................................................................#................
...#..........#....................................................#...............................#...........#.......#..........
...................................#....................#..#.#........#..#.......................#...#.....#......................
.......#.....#.#.......#....#............#...............#..........#.................#........#.#................................
.....#....#.........#........#.......#............................................................................................
..#........#......#............................................................#..........#...............................#.......
..#..#...................................#....................#...#.#................#......................#.....................
....................................#......#.....................#...........#.....................#........#.....................
.#..................#.........................................................................................................#...
..............#...........#.#....#..#......#..#.#...#.#.........................................................................#.
...#............##.......................................................#.......................#..#.............................
......#........#..........#..#.#........#.....................#...................................................................
...#...........#.........................................#............#.............#....#.....................................#..
...........#.....................#......................................................................................#.........
.......#..............#...............#............#..........................#............................#........##............
.............#..........#..............................................#................#..............................#..........
...............#..............................#.................#.....#................#....#.....................................
............#.................#..........#........#............#..#......#.......................#....#...#.#...#.#...............
.......#.#...................................##..............#.....#.....................#.................................##.....
..#..#...#...#....#.............#..#.....................................................................................#........
......#......................#...#...#..........#......................................#.................#....#.................#.
.......#...........#...........#...................#..............................#.......................................#.......
......#.......................................#...............................................#.........#........#....#.........##
......#.................................................................#...#............#..........#.............................
.....................................#..........#.........#.....#.............#...........#.......................................
.#.....................................#......................#.....#..#..........................................................

210
src/day4.cpp Normal file
View File

@ -0,0 +1,210 @@
/*
* <Short Description>
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <day4.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <blt/fs/loader.h>
#include <blt/iterator/enumerate.h>
#include <blt/iterator/zip.h>
#include <blt/std/hashmap.h>
std::vector<char> chars;
const std::string pattern = "XMAS";
const std::string reverse = "SAMX";
const std::string mas = "MAS";
const std::string mas_r = "SAM";
int width, height;
char& get(int x, int y)
{
return chars[y * width + x];
}
bool matches(int x, int y, char c)
{
if (x >= width || y >= height)
return false;
if (x < 0 || y < 0)
return false;
return get(x, y) == c;
}
int search_at(int x, int y)
{
int count = 0;
bool correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x + i, y, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x - i, y, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x, y + i, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x, y - i, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x + i, y + i, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x + i, y - i, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x - i, y + i, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
correct = true;
for (int i = 1; i < pattern.size(); i++)
{
if (!matches(x - i, y - i, pattern[i]))
{
correct = false;
break;
}
}
if (correct)
count++;
return count;
}
bool has(int x, int y, int dirx, int diry)
{
for (int i = 0; i < mas.size(); i++)
{
if (!matches(x + (i * dirx), y + (i * diry), mas[i]))
return false;
}
return true;
}
bool has_r(int x, int y, int dirx, int diry)
{
for (int i = 0; i < mas.size(); i++)
{
if (!matches(x + (i * dirx), y + (i * diry), mas_r[i]))
return false;
}
return true;
}
int x_mas(int x, int y)
{
return (has(x - 1, y - 1, 1, 1) || has_r(x - 1, y - 1, 1, 1)) && (has(x - 1, y + 1, 1, -1) || has_r(x - 1, y + 1, 1, -1));
}
void run_day4()
{
auto file = blt::fs::getLinesFromFile("../problems/day4/input");
width = static_cast<int>(file.size()), height = static_cast<int>(file.begin()->size());
chars.resize(width * height);
for (const auto& [i, line] : blt::enumerate(file))
{
for (const auto [j, c] : blt::enumerate(line))
{
get(j, i) = static_cast<char>(std::toupper(c));
}
}
BLT_TRACE("Width %d Height %d", width, height);
int count = 0;
int count2 = 0;
for (int j = 0; j < height; j++)
{
for (int i = 0; i < width; i++)
{
if (matches(i, j, 'X'))
count += search_at(i, j);
if (matches(i, j, 'A'))
count2 += x_mas(i, j);
}
}
BLT_TRACE("XMASes %d", count);
BLT_TRACE("X-MASes %d", count2);
}

121
src/day5.cpp Normal file
View File

@ -0,0 +1,121 @@
/*
* <Short Description>
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <day5.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <blt/fs/loader.h>
#include <blt/iterator/enumerate.h>
#include <blt/iterator/iterator.h>
#include <blt/iterator/zip.h>
#include <blt/std/hashmap.h>
blt::hashmap_t<int, blt::hashset_t<int>> after;
std::vector<std::vector<int>> page_updates;
std::vector<std::vector<int>> correct_pages;
std::vector<std::vector<int>> incorrect_pages;
bool is_correct(const std::vector<int>& page)
{
for (const auto& [i, v] : blt::enumerate(page))
{
auto cant_be_after = after[v];
for (auto v2 : blt::iterate(page).skip(i))
{
if (cant_be_after.contains(v2))
return false;
}
}
return true;
}
void correct(std::vector<int>& page)
{
std::vector<int> copy = page;
for (const auto& [i, v] : blt::enumerate(page))
{
auto cant_be_after = after[v];
for (auto v2 : blt::iterate(page).skip(i))
{
if (cant_be_after.contains(v2))
{
copy.erase(std::find(copy.begin(), copy.end(), v2));
copy.insert(copy.begin() + static_cast<blt::ptrdiff_t>(i), v2);
}
}
}
// for (const auto& v : copy)
// std::cout << v << ", ";
// std::cout << "\n";
page = copy;
}
void run_day5()
{
auto file = blt::fs::getLinesFromFile("../problems/day5/input");
auto it = file.begin();
while (!it->empty())
{
if (blt::string::contains(*it, ','))
break;
auto line = blt::string::split(*it, '|');
after[std::stoi(line[1])].insert(std::stoi(line[0]));
++it;
}
for (; it != file.end(); ++it)
{
auto line = blt::string::split(*it, ',');
page_updates.emplace_back();
for (const auto& v : line)
page_updates.back().emplace_back(std::stoi(v));
}
for (const auto& pages : page_updates)
{
if (is_correct(pages))
correct_pages.push_back(pages);
else
incorrect_pages.push_back(pages);
}
BLT_TRACE("Correct pages %ld", correct_pages.size());
int count = 0;
for (const auto& page : correct_pages)
{
count += page[(page.size() / 2)];
}
int count2 = 0;
for (auto& page : incorrect_pages)
{
for (int i = 0; i < page.size(); i++)
correct(page);
BLT_TRACE(is_correct(page) ? "True" : "False");
count2 += page[(page.size() / 2)];
}
BLT_TRACE("Total midpoint correct %d", count);
BLT_TRACE("Total midpoint correct (corrected) %d", count2);
}

170
src/day6.cpp Normal file
View File

@ -0,0 +1,170 @@
/*
* <Short Description>
* Copyright (C) 2024 Brett Terpstra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <day6.h>
#include <blt/math/log_util.h>
#include <vector>
#include <limits>
#include <algorithm>
#include <blt/fs/loader.h>
#include <blt/iterator/enumerate.h>
#include <blt/iterator/iterator.h>
#include <blt/iterator/zip.h>
#include <blt/std/hashmap.h>
#include <blt/math/vectors.h>
namespace day6
{
std::vector<std::vector<char>> map;
blt::vec2i guard_pos;
int width, height;
int print_map()
{
int unique = 0;
for (const auto& line : map)
{
for (const auto c : line)
{
BLT_TRACE_STREAM << c;
if (c == 'X' || c == '+' || c == '-' || c == '=' || c == '|' || c == '!')
unique++;
}
BLT_TRACE_STREAM << "\n";
}
return unique;
}
}
bool loops()
{
}
void run_day6()
{
using namespace day6;
auto file = blt::fs::getLinesFromFile("../problems/day6/input");
for (const auto& line : file)
{
map.emplace_back();
for (auto c : line)
map.back().emplace_back(c);
}
height = static_cast<int>(map.size());
width = static_cast<int>(map.begin()->size());
BLT_TRACE("Width %d Height %d", width, height);
for (auto [i, line] : blt::enumerate(map))
{
for (auto [j, c] : blt::enumerate(line))
{
if (c == '^')
{
guard_pos = {j, i};
BLT_TRACE(guard_pos);
goto out;
}
}
}
out:
while (true)
{
const char guard = map[guard_pos.y()][guard_pos.x()];
map[guard_pos.y()][guard_pos.x()] = 'X';
switch (guard)
{
case '^':
if (guard_pos.y() - 1 < 0)
goto exit;
if (map[guard_pos.y() - 1][guard_pos.x()] != '#')
{
map[guard_pos.y()][guard_pos.x()] = '|';
guard_pos -= blt::vec2i{0, 1};
map[guard_pos.y()][guard_pos.x()] = '^';
}else
{
map[guard_pos.y()][guard_pos.x()] = '+';
guard_pos += blt::vec2i{1, 0};
map[guard_pos.y()][guard_pos.x()] = '>';
}
break;
case '>':
if (guard_pos.x() + 1 >= width)
goto exit;
if (map[guard_pos.y()][guard_pos.x() + 1] != '#')
{
map[guard_pos.y()][guard_pos.x()] = '-';
guard_pos += blt::vec2i{1, 0};
map[guard_pos.y()][guard_pos.x()] = '>';
}else
{
map[guard_pos.y()][guard_pos.x()] = '+';
guard_pos += blt::vec2i{0, 1};
map[guard_pos.y()][guard_pos.x()] = 'v';
}
break;
case 'v':
if (guard_pos.y() + 1 >= height)
goto exit;
if (map[guard_pos.y() + 1][guard_pos.x()] != '#')
{
map[guard_pos.y()][guard_pos.x()] = '!';
guard_pos += blt::vec2i{0, 1};
map[guard_pos.y()][guard_pos.x()] = 'v';
}else
{
map[guard_pos.y()][guard_pos.x()] = '+';
guard_pos -= blt::vec2i{1, 0};
map[guard_pos.y()][guard_pos.x()] = '<';
}
break;
case '<':
if (guard_pos.x() - 1 < 0)
goto exit;
if (map[guard_pos.y()][guard_pos.x() - 1] != '#')
{
map[guard_pos.y()][guard_pos.x()] = '=';
guard_pos -= blt::vec2i{1, 0};
map[guard_pos.y()][guard_pos.x()] = '<';
}else
{
map[guard_pos.y()][guard_pos.x()] = '+';
guard_pos -= blt::vec2i{0, 1};
map[guard_pos.y()][guard_pos.x()] = '^';
}
break;
default:
BLT_ERROR("Hey this shouldn't be possible! %c", guard);
BLT_TRACE(print_map());
std::exit(-1);
break;
}
}
exit:
const auto unique = print_map();
BLT_TRACE("Unique Pos %d", unique);
}

View File

@ -3,6 +3,9 @@
#include <day1.h>
#include <day2.h>
#include <day3.h>
#include <day4.h>
#include <day5.h>
#include <day6.h>
int main(const int argc, const char** argv)
{
@ -30,6 +33,15 @@ int main(const int argc, const char** argv)
run_day3();
break;
case 4:
run_day4();
break;
case 5:
run_day5();
break;
case 6:
run_day6();
break;
case 7:
break;
default:
BLT_INFO("%d is not a day", day);