Add gitignore and standard project file
This commit is contained in:
parent
007751d1a7
commit
a836b93150
9 changed files with 81 additions and 18 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.ccls-cache
|
BIN
day01/day1Part1
BIN
day01/day1Part1
Binary file not shown.
|
@ -14,6 +14,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
if (lastValue != 0)
|
if (lastValue != 0)
|
||||||
{
|
{
|
||||||
|
return 1;
|
||||||
if (lastValue < currentValue) decreaseCount++;
|
if (lastValue < currentValue) decreaseCount++;
|
||||||
}
|
}
|
||||||
lastValue = currentValue;
|
lastValue = currentValue;
|
||||||
|
|
BIN
day01/day1Part2
BIN
day01/day1Part2
Binary file not shown.
|
@ -17,7 +17,7 @@ int main(void)
|
||||||
sum1 = lastValue + middleValue + currentValue;
|
sum1 = lastValue + middleValue + currentValue;
|
||||||
if (lastValue != 0)
|
if (lastValue != 0)
|
||||||
{
|
{
|
||||||
if (sum2 != 0 && sum2 < sum1)
|
if (sum2 != 0 && sum2 < sum1)
|
||||||
{
|
{
|
||||||
//cout << "*++*\t";
|
//cout << "*++*\t";
|
||||||
decreaseCount++;
|
decreaseCount++;
|
||||||
|
|
|
@ -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 <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -5,30 +8,63 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#define INF 10
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int lineLength = 0;
|
int arrayXsize, arrayYsize;
|
||||||
int pathCost = 0;
|
bool finalCode = false;
|
||||||
bool firstLine = true;
|
if (!finalCode)
|
||||||
vector<int> map;
|
|
||||||
int tempInt = 0;
|
|
||||||
string rawInput;
|
|
||||||
ifstream readFile ("data/input.txt", ios::in);
|
|
||||||
while(getline(readFile, rawInput))
|
|
||||||
{
|
{
|
||||||
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();
|
//shrink xSize and ySize properly, using manhattan dist.
|
||||||
firstLine = false;
|
remainingMap[i][j] = ((arrayXsize - 1) - j) +
|
||||||
}
|
((arrayYsize - 1) - i);
|
||||||
for(int i = 0; i < rawInput.size(); i++)
|
|
||||||
{
|
|
||||||
tempInt = rawInput[i]-'0';
|
|
||||||
map.push_back(tempInt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << lineLength;
|
vector<pair<int,int>> 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<int, int> vectorAddPair;
|
||||||
|
// Pairs are initialized as (note namespace);
|
||||||
|
vectorAddPair = make_pair(0,0);
|
||||||
|
// add pair to vector
|
||||||
|
pathThruMap.push_back(vectorAddPair);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
10
testProject/Header/Pathing.h
Executable file
10
testProject/Header/Pathing.h
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef PATHING_H
|
||||||
|
#define PATHING_H
|
||||||
|
|
||||||
|
class Pathing
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int Month(int num);
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
6
testProject/Source/Pathing.cpp
Executable file
6
testProject/Source/Pathing.cpp
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#include "../Header/Pathing.h"
|
||||||
|
|
||||||
|
int Pathing::Month(int num)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
9
testProject/Source/main.cpp
Executable file
9
testProject/Source/main.cpp
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include "../Header/Pathing.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Pathing path;
|
||||||
|
|
||||||
|
path.Month(2);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue