diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a173085 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.ccls-cache diff --git a/day01/day1Part1 b/day01/day1Part1 index 359c320..4ecfc0b 100755 Binary files a/day01/day1Part1 and b/day01/day1Part1 differ diff --git a/day01/day1Part1.cpp b/day01/day1Part1.cpp index b7f6d29..74bb0a3 100644 --- a/day01/day1Part1.cpp +++ b/day01/day1Part1.cpp @@ -14,6 +14,7 @@ int main(void) { if (lastValue != 0) { + return 1; if (lastValue < currentValue) decreaseCount++; } lastValue = currentValue; diff --git a/day01/day1Part2 b/day01/day1Part2 index b9cf014..490c652 100755 Binary files a/day01/day1Part2 and b/day01/day1Part2 differ diff --git a/day01/day1Part2.cpp b/day01/day1Part2.cpp index 3fe2c93..86fd3fa 100644 --- a/day01/day1Part2.cpp +++ b/day01/day1Part2.cpp @@ -17,7 +17,7 @@ int main(void) sum1 = lastValue + middleValue + currentValue; if (lastValue != 0) { - if (sum2 != 0 && sum2 < sum1) + if (sum2 != 0 && sum2 < sum1) { //cout << "*++*\t"; decreaseCount++; diff --git a/day15/day15Part1.cpp b/day15/day15Part1.cpp index 7bff7a5..916875f 100644 --- a/day15/day15Part1.cpp +++ b/day15/day15Part1.cpp @@ -1,3 +1,6 @@ +// The A* implementation used in this code is +// a modified form of Dijkstra's Algorithm, as +// see on the YouTube channel "Friendly Developer" #include #include #include @@ -5,30 +8,63 @@ #include #include +#define INF 10 + using namespace std; int main(void) { - int lineLength = 0; - int pathCost = 0; - bool firstLine = true; - vector map; - int tempInt = 0; - string rawInput; - ifstream readFile ("data/input.txt", ios::in); - while(getline(readFile, rawInput)) + int arrayXsize, arrayYsize; + bool finalCode = false; + if (!finalCode) { - if(firstLine) + arrayXsize = 10; + arrayYsize = 10; + } + if (finalCode) + { + arrayXsize = 100; + arrayYsize = 100; + } + int map[arrayYsize][arrayXsize]; + int distMap[arrayYsize][arrayXsize] = {INF}; + int remainingMap[arrayYsize][arrayXsize]; + for (int i = 0; i < arrayYsize; i++) + { + for (int j = 0; j < arrayXsize; j++) { - lineLength = rawInput.size(); - firstLine = false; - } - for(int i = 0; i < rawInput.size(); i++) - { - tempInt = rawInput[i]-'0'; - map.push_back(tempInt); + //shrink xSize and ySize properly, using manhattan dist. + remainingMap[i][j] = ((arrayXsize - 1) - j) + + ((arrayYsize - 1) - i); } } - cout << lineLength; + vector> pathThruMap; + int lineLength = 0; + int pathCost = 0; + int xIndex = 0; + int yIndex = 0; + int tempInt = 0; + string rawInput; + ifstream readFile ("data/testInput.txt", ios::in); + + while(getline(readFile, rawInput)) + { + for(int xIndex = 0; + xIndex < rawInput.size(); + xIndex++) + { + tempInt = rawInput[xIndex]-'0'; + map[yIndex][xIndex] = tempInt; + } + yIndex++; + } + + // Pairs are basically coordinates + pair vectorAddPair; + // Pairs are initialized as (note namespace); + vectorAddPair = make_pair(0,0); + // add pair to vector + pathThruMap.push_back(vectorAddPair); + return 0; } diff --git a/testProject/Header/Pathing.h b/testProject/Header/Pathing.h new file mode 100755 index 0000000..06a1393 --- /dev/null +++ b/testProject/Header/Pathing.h @@ -0,0 +1,10 @@ +#ifndef PATHING_H +#define PATHING_H + +class Pathing +{ +public: +int Month(int num); + +}; +#endif diff --git a/testProject/Source/Pathing.cpp b/testProject/Source/Pathing.cpp new file mode 100755 index 0000000..ac3ecfe --- /dev/null +++ b/testProject/Source/Pathing.cpp @@ -0,0 +1,6 @@ +#include "../Header/Pathing.h" + +int Pathing::Month(int num) +{ + return 0; +} diff --git a/testProject/Source/main.cpp b/testProject/Source/main.cpp new file mode 100755 index 0000000..883fdbb --- /dev/null +++ b/testProject/Source/main.cpp @@ -0,0 +1,9 @@ +#include +#include "../Header/Pathing.h" + +int main() +{ + Pathing path; + + path.Month(2); +}