Skip to content

Commit

Permalink
Bugfix in ConstellationsGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 7, 2024
1 parent b1c4ab0 commit c7f2b18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/main/java/de/nqueensfaf/Solver.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ private Thread backgroundThread(boolean updateConsumer, boolean autoSaver) {
float tmpProgress = progress;

while (isRunning() && getProgress() < 1f) {
if(updateConsumer) {
if(updateConsumer)
onUpdateConsumer.accept(this, getProgress(), getSolutions(), getDuration());
}

if(autoSaver) {
progress = getProgress() * 100;
Expand All @@ -147,6 +146,9 @@ else if (progress >= tmpProgress + config().autoSavePercentageStep) {
// ignore
}
}

if(updateConsumer)
onUpdateConsumer.accept(this, getProgress(), getSolutions(), getDuration());

if(autoSaver) {
progress = getProgress() * 100;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/nqueensfaf/impl/ConstellationsGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ArrayList<Constellation> generate(Consumer<Constellation> constellationCo
// jkl and sym and start are the same for all subconstellations
for (int a = 0; a < subConstellationsCounter; a++) {
var c = constellations.get(currentSize - a - 1);
c.setStartIjkl(c.getStart() | ijkl);
c.setStartIjkl(c.getStartIjkl() | ijkl);
c.setId(currentSize - a - 1);

if(constellationConsumer != null)
Expand All @@ -87,7 +87,7 @@ public ArrayList<Constellation> generateSubConstellations(ArrayList<Constellatio
// jkl and sym and start are the same for all subconstellations
for (int a = 0; a < subConstellationsCounter; a++) {
var c = constellations.get(currentSize - a - 1);
c.setStartIjkl(c.getStart() | bc.getIjkl());
c.setStartIjkl(c.getStartIjkl() | bc.getIjkl());
c.setId(bc.getId());
}
}
Expand Down

0 comments on commit c7f2b18

Please sign in to comment.