Updated comments and made sure style was consistent

This commit is contained in:
2020-07-10 13:36:16 -04:00
parent 7257a118d4
commit c72754dcf8
65 changed files with 1160 additions and 747 deletions

View File

@@ -1,7 +1,7 @@
//ProjectEuler/C++/Headers/Problem67.hpp
//ProjectEuler/ProjectEulerCPP/Headers/Problem67.hpp
//Matthew Ellison
// Created: 11-02-18
//Modified: 07-14-19
//Modified: 07-09-20
//The way to do this is using a breadth first search
/*
Find the maximum total from top to bottom
@@ -108,7 +108,7 @@ Find the maximum total from top to bottom
*/
//Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/myClasses
/*
Copyright (C) 2019 Matthew Ellison
Copyright (C) 2020 Matthew Ellison
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -136,6 +136,7 @@ Find the maximum total from top to bottom
class Problem67 : public Problem{
private:
//Structures
struct location{
int xLocation;
int yLocation;
@@ -143,18 +144,25 @@ private:
bool fromRight;
location(int x, int y, int t, bool r) : xLocation(x), yLocation(y), total(t), fromRight(r){ }
};
void invert(); //This function takes every number in the vector and changes it to 100 - the number
//Variables
//Static variables
static const int NUM_ROWS = 100; //The number of rows in the list of numbers
static std::vector<int> list[NUM_ROWS]; //This is the list you are trying to find a path through
//Instance variables
std::list<location> foundPoints; //For the points that I have already found the shortest distance to
std::list<location> possiblePoints; //For the locations you are checking this round
int actualTotal; //The true total of the path from the top to the bottom
//This is the list you are trying to find a path through
static std::vector<int> list[NUM_ROWS];
//Functions
void invert(); //This function takes every number in the vector and changes it to 100 - the number
public:
//Constructor
Problem67();
virtual void solve();
virtual std::string getString() const;
virtual void reset();
//Operational functions
virtual void solve(); //Solve the problem
virtual void reset(); //Reset the problem so it can be run again
//Gets
virtual std::string getString() const; //Return a string with the solution to the problem
std::string getPyramid() const; //Returns the pyramid that was traversed as a string
std::string getTrail(); //Returns the trail the algorithm took as a string
int getTotal() const; //Returns the total that was asked for
@@ -162,7 +170,7 @@ public:
/* Results:
The value of the longest path is 7273
It took 208.728 milliseconds to solve this problem.
It took an average of 366.373 milliseconds to run this problem over 100 iterations
*/
#endif //PROBLEM67_HPP