Day 4 was MUCH easier than REGEX DAY 3.
This commit is contained in:
parent
c4d14c613d
commit
8fb1a7d95c
2
2024/4/Makefile
Normal file
2
2024/4/Makefile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
a.out: main.cpp
|
||||||
|
clang++ -std=c++2b -g -O0 main.cpp
|
140
2024/4/data.txt
Normal file
140
2024/4/data.txt
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
MMSAXXMMMMSMSMXMXSSMAMSMSXMASMMAXMASMMSMMAMXXMASXMXXXMSASXSSMMXSAMXXMAXXSMSMSMXXAMXAXMMMSMXAMMASMSMXAMXXMMMMSMSXSAAMXMMMSAMXSMMMMMSAMMSMSXXX
|
||||||
|
MASMMSMMAMMAMMASXMXXAMXMSXAAXAXAMXMXMASXXASXSSSMXXMAMAASXXSAMXASASASXSSMMASAAMSMSMSXSAAAAMMMSMMMMAMSASMMMMXAAXXAXMMSAMMSAMXAAMASAMMASAAMSMMS
|
||||||
|
MMSMASMSAMMAMSMSAASMMSAMSMMXXMMXXASXSXXASXSAASAMXAAAMMSAMXSXMMMSAMASMAAXMAXMAMSAAMAAMMMSASAAAAXASMMAAMMAXAMMSSMXMMASASXSAMMSMSAXAXSAMMMSXMAA
|
||||||
|
XSXMXSASASXMMMASMMMAXXAMXAXMXSAMSXSASMXMSSMMMXMSSSSXSMMASASASAMMAMSMMSMMMMSSMAMSMMXSSMMMMAMMSSMASXMMXMXXMSSXAAAAMMAMSMXSAMAAAMMSSMMASAMSAMSS
|
||||||
|
MMMSMMAMAMXAAXXXMXMXMMMMSMMAMMAMXAMAMXSXMAXAMAXXAAXMAXSAMASASMSSSMAAXMAAAAAAMXMXSXAMXAXSXSMMAMMAMAXXXMSMAAXXMMSXSAASXMASAMSXSSMXAASAMMMSAMMX
|
||||||
|
MAAAAMAMXMSMMXMASMXXMASXSAMSASMMSAMXMAMMSMMXSMSMMMMXMMMSMMMMMMXAMXSMMXXSMSXXMASXMMAXSMMSXMAMMSMXSAMXAAMMMMSM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MAAAXAAXMAMAXAXXAMAMAMXAMMMSXSASMSXMAMMASMMASAMMMSSMSAMXMXMMMMAMXXMASMXAAXMAXXAXXAMXAAAAXMMXMMSMSMAAXMSMXXXMASAMASMSXXASMM
|
||||||
|
SMXMMASMSMXXXMXAMAMXMXMSMMXASMSSMMSAAMAMXAMXXAAXMMMSASXMAXAASAMASAAXAMXMSMSMMAAMAMMMMAMXXMSMMXSXAAMMMMMMMMMMXMAXAMXMSMMXMMMSXMMSMMASMXAMXSAS
|
||||||
|
XXSASMMAAASMSMMXSAMMSAMXXMMMSXSAAXMSMSXSMMMSAMMAXAAMXMASXMMXMASAMMSSSMAXAAAMSMMSAMSAMSSSMXXAMAMMMMAAAXAAXXMAAXMMMSSMMSMMXMASAMAMMMMSASXSASMM
|
||||||
|
SMMXMMMMMSMAASAASAMXAASAAAXAMXXMMMXAMXAXXAAXAAXXSMMSAMXMASXASMMMAXAAASASMSMMAAXSAMMASXAAXAXXMASAXXXSASXSSMMSXSAXSAAAAAXSSMASAMXSAASMAMAMASMX
|
||||||
|
XXMASXASXXMSMMMXSAMXSXMXXSMXSAXXMXSMSMXMMMSSSMAAMAXSAXASAASMMXMASAMSMMMSAXXSMSMSSMSXMMSMMMSXSMSMSXMXMMMAXXMAXSAMMSSMMXSAAMMSMMSSMSSMXMXMAMAS
|
10
2024/4/data_test.txt
Normal file
10
2024/4/data_test.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MMMSXXMASM
|
||||||
|
MSAMXMSMSA
|
||||||
|
AMXSXMAAMM
|
||||||
|
MSAMASMSMX
|
||||||
|
XMASAMXAMM
|
||||||
|
XXAMMXXAMA
|
||||||
|
SMSMSASXSS
|
||||||
|
SAXAMASAAA
|
||||||
|
MAMMMXMMMM
|
||||||
|
MXMXAXMASX
|
169
2024/4/main.cpp
Normal file
169
2024/4/main.cpp
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <set>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
const std::string filename = "data.txt";
|
||||||
|
std::ifstream ifs(filename);
|
||||||
|
if(!ifs.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Missing " << filename << "." << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long total = 0;
|
||||||
|
unsigned long total_pt2 = 0;
|
||||||
|
|
||||||
|
std::vector<std::vector<char>> game;
|
||||||
|
|
||||||
|
for(std::string line; std::getline(ifs, line); )
|
||||||
|
{
|
||||||
|
if(line == "")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Add new row to fill out:
|
||||||
|
game.push_back({});
|
||||||
|
|
||||||
|
// for each value in the line:
|
||||||
|
for(const char &c : line)
|
||||||
|
{
|
||||||
|
// Fill out the row:
|
||||||
|
game.back().push_back(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEBUG:
|
||||||
|
// for(auto row : game)
|
||||||
|
// {
|
||||||
|
// for(auto c : row)
|
||||||
|
// std::cout << c;
|
||||||
|
// std::cout << std::endl;
|
||||||
|
// }
|
||||||
|
|
||||||
|
for(int y = 0; y < game.size(); ++y)
|
||||||
|
{
|
||||||
|
for(int x = 0; x < game[y].size(); ++x)
|
||||||
|
{
|
||||||
|
// right:
|
||||||
|
if(x + 3 < game[y].size())
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y][x+1] == 'M' &&
|
||||||
|
game[y][x+2] == 'A' &&
|
||||||
|
game[y][x+3] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// down right:
|
||||||
|
if(x + 3 < game[y].size() &&
|
||||||
|
y + 3 < game.size())
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y+1][x+1] == 'M' &&
|
||||||
|
game[y+2][x+2] == 'A' &&
|
||||||
|
game[y+3][x+3] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// down:
|
||||||
|
if(y + 3 < game.size())
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y+1][x] == 'M' &&
|
||||||
|
game[y+2][x] == 'A' &&
|
||||||
|
game[y+3][x] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// down left:
|
||||||
|
if(x - 3 >= 0 &&
|
||||||
|
y + 3 < game.size())
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y+1][x-1] == 'M' &&
|
||||||
|
game[y+2][x-2] == 'A' &&
|
||||||
|
game[y+3][x-3] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// left:
|
||||||
|
if(x - 3 >= 0)
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y][x-1] == 'M' &&
|
||||||
|
game[y][x-2] == 'A' &&
|
||||||
|
game[y][x-3] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// up left:
|
||||||
|
if(x - 3 >= 0 &&
|
||||||
|
y - 3 >= 0)
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y-1][x-1] == 'M' &&
|
||||||
|
game[y-2][x-2] == 'A' &&
|
||||||
|
game[y-3][x-3] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// up:
|
||||||
|
if(y - 3 >= 0)
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y-1][x] == 'M' &&
|
||||||
|
game[y-2][x] == 'A' &&
|
||||||
|
game[y-3][x] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// up right:
|
||||||
|
if(x + 3 < game[y].size() &&
|
||||||
|
y - 3 >= 0)
|
||||||
|
{
|
||||||
|
if(game[y][x] == 'X' &&
|
||||||
|
game[y-1][x+1] == 'M' &&
|
||||||
|
game[y-2][x+2] == 'A' &&
|
||||||
|
game[y-3][x+3] == 'S')
|
||||||
|
++total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int y = 1; y < game.size() - 1; ++y)
|
||||||
|
{
|
||||||
|
for(int x = 1; x < game[y].size() - 1; ++x)
|
||||||
|
{
|
||||||
|
if(game[y][x] != 'A')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int good = 0;
|
||||||
|
// top left to bottom right
|
||||||
|
if((game[y-1][x-1] == 'M' &&
|
||||||
|
game[y+1][x+1] == 'S')
|
||||||
|
||
|
||||||
|
(game[y-1][x-1] == 'S' &&
|
||||||
|
game[y+1][x+1] == 'M'))
|
||||||
|
++good;
|
||||||
|
// top right to bottom left
|
||||||
|
if((game[y-1][x+1] == 'M' &&
|
||||||
|
game[y+1][x-1] == 'S')
|
||||||
|
||
|
||||||
|
(game[y-1][x+1] == 'S' &&
|
||||||
|
game[y+1][x-1] == 'M'))
|
||||||
|
++good;
|
||||||
|
|
||||||
|
if(good == 2)
|
||||||
|
++total_pt2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << " Total: " << total << std::endl;
|
||||||
|
std::cout << "PT2 Total: " << total_pt2 << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user