mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-07 01:23:56 -05:00
Fixed issue with the 0 option not solving all problems
This commit is contained in:
@@ -83,10 +83,10 @@ public class Driver{
|
|||||||
//This selection solves all problems in order
|
//This selection solves all problems in order
|
||||||
if(problemNumber.equals(0)){
|
if(problemNumber.equals(0)){
|
||||||
//Solve to every valid problem number, skipping over 0
|
//Solve to every valid problem number, skipping over 0
|
||||||
for(Integer problemLocation = 1;problemLocation < PROBLEM_NUMBERS.size();++problemLocation){
|
for(Integer problemLocation = PROBLEM_NUMBERS.get(1);problemLocation < PROBLEM_NUMBERS.size();++problemLocation){
|
||||||
//Solve the problem
|
//Solve the problems
|
||||||
System.out.print(PROBLEM_NUMBERS.get(problemLocation).toString() + ". ");
|
System.out.print(PROBLEM_NUMBERS.get(problemLocation).toString() + ". ");
|
||||||
solveProblem(problemLocation);
|
solveProblem(PROBLEM_NUMBERS.get(problemLocation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//This is if a single problem number was chosen
|
//This is if a single problem number was chosen
|
||||||
@@ -99,8 +99,7 @@ public class Driver{
|
|||||||
//Get the problem
|
//Get the problem
|
||||||
Problem problem = getProblem(problemNumber);
|
Problem problem = getProblem(problemNumber);
|
||||||
//Print the problem description
|
//Print the problem description
|
||||||
String description = problem.getDescription();
|
System.out.println(problem.getDescription());
|
||||||
System.out.println(description);
|
|
||||||
//Solve the problem
|
//Solve the problem
|
||||||
problem.solve();
|
problem.solve();
|
||||||
//Print the results
|
//Print the results
|
||||||
@@ -153,10 +152,10 @@ public class Driver{
|
|||||||
//If the problem number is 0 print out all the descriptions
|
//If the problem number is 0 print out all the descriptions
|
||||||
if(problemNumber.equals(0)){
|
if(problemNumber.equals(0)){
|
||||||
//Print description for every valid problem number, skipping over 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
|
//Print the problem's description
|
||||||
System.out.print(PROBLEM_NUMBERS.get(problemLocation) + ". ");
|
System.out.print(PROBLEM_NUMBERS.get(problemLocation) + ". ");
|
||||||
printDescription(problemLocation);
|
printDescription(PROBLEM_NUMBERS.get(problemLocation));
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user