Updated various typoes and removed some unneeded code

This commit is contained in:
2020-07-11 13:35:37 -04:00
parent c72754dcf8
commit 0caa043b59
17 changed files with 31 additions and 33 deletions

View File

@@ -35,7 +35,7 @@ int Problem15::LENGTH = 20; //The length of the grid
//This function acts as a handler for moving the position on the grid and counting the distance
//It moves right first, then down
void Problem15::move(int currentX, int currentY, uint64_t& numOfRoutes){
void Problem15::move(int currentX, int currentY){
//Check if you are at the end
if((currentX == WIDTH) && (currentY == LENGTH)){
++numOfRoutes;
@@ -44,12 +44,12 @@ void Problem15::move(int currentX, int currentY, uint64_t& numOfRoutes){
//Move right if possible
if(currentX < WIDTH){
move(currentX + 1, currentY, numOfRoutes);
move(currentX + 1, currentY);
}
//Move down if possible
if(currentY < LENGTH){
move(currentX, currentY + 1, numOfRoutes);
move(currentX, currentY + 1);
}
}
@@ -73,7 +73,7 @@ void Problem15::solve(){
//We write this as a recursive function
//When in a location it always moves right first, then down
move(currentX, currentY, numOfRoutes);
move(currentX, currentY);
//Stop the timer
timer.stop();