Updated to use new library layout

This commit is contained in:
2021-07-14 15:38:17 -04:00
parent ad2e948a42
commit b5c1df010f
39 changed files with 316 additions and 493 deletions

View File

@@ -1,7 +1,7 @@
//ProjectEulerTS/Problems/Problem15.ts
//Matthew Ellison
// Created: 03-29-21
//Modified: 03-29-21
//Modified: 07-14-21
//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/typescriptClasses
/*
@@ -22,7 +22,6 @@
*/
import { Unsolved } from "../Unsolved";
import { Problem } from "./Problem";
@@ -51,10 +50,12 @@ export class Problem15 extends Problem{
//Start the timer
this.timer.start();
//We write this as a recursive function
//When in a location it always move right first, then down
this.move(0, 0);
//Stop the timer
this.timer.stop();
@@ -88,20 +89,17 @@ export class Problem15 extends Problem{
//Gets
//Returns the result of solving the problem
public getResult(): string{
if(!this.solved){
throw new Unsolved();
}
this.solvedCheck("result");
return `The number of routes is ${this.numOfRoutes}`;
}
//Returns the number of routes found
public getNumberOfRoutes(): number{
if(!this.solved){
throw new Unsolved();
}
this.solvedCheck("number of routes");
return this.numOfRoutes;
}
}
/* Results:
The number of routes is 137846528820
It took 37.058 minutes to solve this problem.