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,11 +1,11 @@
//ProjectEuler/C++/Headers/Problem15.hpp
//ProjectEuler/ProjectEulerCPP/Headers/Problem15.hpp
//Matthew Ellison
// Created: 09-29-18
//Modified: 07-14-19
//Modified: 07-09-20
//How many routes from the top left corner to the bottom right corner are there through a 20×20 grid if you can only move right and down?
//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
@@ -32,23 +32,30 @@
class Problem15 : public Problem{
private:
//Variables
//Static variables
static int WIDTH; //The width of the grid
static int LENGTH; //The length of the grid
//Instance variables
uint64_t numOfRoutes; //The number of routes from 0, 0 to 20, 20
//Functions
//This function acts as a handler for moving the position on the grid and counting the distance
//If moves right first, then down
//It moves right first, then down
void move(int currentX, int currentY, uint64_t& numOfRoutes);
public:
//Constructor
Problem15();
virtual void solve();
virtual std::string getString() const;
virtual void reset();
//Returns the number of routes found
uint64_t getNumberOfRoutes() const;
//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
uint64_t getNumberOfRoutes() const; //Returns the number of routes found
};
/* Results:
The number of routes is 137846528820
It took 10.914 minutes to solve this problem.
It took an average of 18.010 minutes to run this problem through 10 iterations
*/
#endif //PROBLEM15_HPP