diff --git a/CHANGELOG.md b/CHANGELOG.md index a38dd76..f604592 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,12 @@ CHANGELOG ### Version 11 -- Show number of different solutions found by the AI - cycle through different solutions if more than one solution is found +### Version 10.2 + +- Show number of different solutions found by the AI + ### Version 10.1 - remove white circles in the background of robots diff --git a/app/build.gradle b/app/build.gradle index 273a77c..3e712e0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "de.z11.roboyard" minSdkVersion 19 targetSdkVersion 30 - versionCode 38 - versionName "11" + versionCode 39 + versionName "10.2" } buildTypes { release { diff --git a/app/src/main/java/roboyard/eclabs/GridGameScreen.java b/app/src/main/java/roboyard/eclabs/GridGameScreen.java index 1d6f1dc..8c66907 100644 --- a/app/src/main/java/roboyard/eclabs/GridGameScreen.java +++ b/app/src/main/java/roboyard/eclabs/GridGameScreen.java @@ -33,7 +33,7 @@ public class GridGameScreen extends GameScreen { private int solutionMoves = 0; // store the optimal number of moves for the solution globally private int NumDifferentSolutionsFound = 0; // store the number of different solution globally private int numSolutionClicks = 0; // count how often you clicked on the solution button, each time the shown count goes down by one - private int numDifferentSolutionClicks = 0; // count how often you clicked on the solution button again to show a different solution + private int numDifferentSolutionClicks = 0; // count how often you clicked on the solution button again to show a different solution (currently disabled) private int showSolutionAtHint = 5; // interval between the first hint and the current optimal solution (will be set to random 3..5 later private static int goodPuzzleMinMoves = 8; // below this number of moves there is a special hint shown from the start @@ -388,7 +388,7 @@ public void update(GameManager gameManager){ isSolved = true; buttonSolve.setEnabled(true); NumDifferentSolutionsFound=solver.getSolutionList().size(); - GameSolution solution = solver.getSolution(numDifferentSolutionClicks); + GameSolution solution = solver.getSolution(); solutionMoves=0; for(IGameMove m : solution.getMoves()){ solutionMoves++; @@ -772,7 +772,7 @@ public void execute(){ private class ButtonSolution implements IExecutor{ public void execute(){ if(numSolutionClicks >= showSolutionAtHint) { - GameSolution solution = solver.getSolution(numDifferentSolutionClicks); + GameSolution solution = solver.getSolution(); showSolution(solution); if(NumDifferentSolutionsFound > 1){ // if solution is shown and there are more than 1 solutions found: @@ -781,7 +781,7 @@ public void execute(){ }else{ numDifferentSolutionClicks++; } - gameManager.requestToast("Press again to see solution " + (numDifferentSolutionClicks + 1), false); + // gameManager.requestToast("Press again to see solution " + (numDifferentSolutionClicks + 1), false); } }else{ numSolutionClicks++; diff --git a/app/src/main/java/roboyard/eclabs/solver/ISolver.java b/app/src/main/java/roboyard/eclabs/solver/ISolver.java index d7e1363..2914554 100644 --- a/app/src/main/java/roboyard/eclabs/solver/ISolver.java +++ b/app/src/main/java/roboyard/eclabs/solver/ISolver.java @@ -16,6 +16,6 @@ public interface ISolver extends Runnable { void init(ArrayList elements); void run(); SolverStatus getSolverStatus(); - GameSolution getSolution(int num); + GameSolution getSolution(); List getSolutionList(); } diff --git a/app/src/main/java/roboyard/eclabs/solver/SolverDD.java b/app/src/main/java/roboyard/eclabs/solver/SolverDD.java index 123f519..3916145 100644 --- a/app/src/main/java/roboyard/eclabs/solver/SolverDD.java +++ b/app/src/main/java/roboyard/eclabs/solver/SolverDD.java @@ -23,12 +23,14 @@ public class SolverDD implements ISolver{ private SolverStatus solverStatus; private Solver solver; + private Solution solution; private List solutions; private final RRPiece[] pieces; public SolverDD(){ solver = null; solverStatus = SolverStatus.idle; + solution = null; solutions = null; pieces = new RRPiece[4]; } @@ -51,7 +53,7 @@ public void run() { try { solutions = solver.execute(); if(solutions.size() != 0){ - Solution solution = solutions.get(0); + solution = solutions.get(0); System.out.println(solutions.size() + " solution(s) found; first solution:"); System.out.println(solution.toString()); solverStatus = SolverStatus.solved; @@ -76,9 +78,9 @@ public List getSolutionList(){ * @param num number of the solution in the solutions list * @return GameSolution with all moves in that solution */ - public GameSolution getSolution(int num){ + public GameSolution getSolution(){ GameSolution s = new GameSolution(); - Solution solution = solutions.get(num); + solution.resetMoves(); Move m = solution.getNextMove(); while (m != null){ diff --git a/download/Roboyard_v10.2.apk b/download/Roboyard_v10.2.apk new file mode 100644 index 0000000..7019491 Binary files /dev/null and b/download/Roboyard_v10.2.apk differ