From 534e1ed68800052a5cfa1c9f599f8e6c85fedac7 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Mon, 8 Jun 2020 01:23:32 -0400 Subject: [PATCH] Fixed issue with the 0 option not solving all problems --- src/main/java/mattrixwv/ProjectEuler/Driver.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/mattrixwv/ProjectEuler/Driver.java b/src/main/java/mattrixwv/ProjectEuler/Driver.java index 2b7ec4d..c03a609 100644 --- a/src/main/java/mattrixwv/ProjectEuler/Driver.java +++ b/src/main/java/mattrixwv/ProjectEuler/Driver.java @@ -83,10 +83,10 @@ public class Driver{ //This selection solves all problems in order if(problemNumber.equals(0)){ //Solve to every valid problem number, skipping over 0 - for(Integer problemLocation = 1;problemLocation < PROBLEM_NUMBERS.size();++problemLocation){ - //Solve the problem + for(Integer problemLocation = PROBLEM_NUMBERS.get(1);problemLocation < PROBLEM_NUMBERS.size();++problemLocation){ + //Solve the problems System.out.print(PROBLEM_NUMBERS.get(problemLocation).toString() + ". "); - solveProblem(problemLocation); + solveProblem(PROBLEM_NUMBERS.get(problemLocation)); } } //This is if a single problem number was chosen @@ -99,8 +99,7 @@ public class Driver{ //Get the problem Problem problem = getProblem(problemNumber); //Print the problem description - String description = problem.getDescription(); - System.out.println(description); + System.out.println(problem.getDescription()); //Solve the problem problem.solve(); //Print the results @@ -153,10 +152,10 @@ public class Driver{ //If the problem number is 0 print out all the descriptions if(problemNumber.equals(0)){ //Print description for every valid problem number, skipping over 0 - for(Integer problemLocation = PROBLEM_NUMBERS.get(1);problemLocation < PROBLEM_NUMBERS.size();++problemLocation){ + for(Integer problemLocation = 1;problemLocation < PROBLEM_NUMBERS.size();++problemLocation){ //Print the problem's description System.out.print(PROBLEM_NUMBERS.get(problemLocation) + ". "); - printDescription(problemLocation); + printDescription(PROBLEM_NUMBERS.get(problemLocation)); System.out.println(); } }