Skip to content

Commit

Permalink
Added getStart() method to Constellation class
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 7, 2024
1 parent adccfef commit 7e38b18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/de/nqueensfaf/impl/Constellation.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ public void setSolutions(long solutions) {
public int getIjkl() {
return startIjkl & 0b11111111111111111111;
}

public int getStart() {
return startIjkl >> 20;
}
}
6 changes: 3 additions & 3 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.getStartIjkl() | ijkl);
c.setStartIjkl(c.getStart() | ijkl);
c.setId(currentSize - a - 1);

if(constellationConsumer != null)
Expand All @@ -81,13 +81,13 @@ public ArrayList<Constellation> generateSubConstellations(ArrayList<Constellatio
subConstellationsCounter = 0;

placePresetQueens(bc.getLd(), bc.getRd(), bc.getCol(), getk(bc.getIjkl()), getl(bc.getIjkl()),
bc.getStartIjkl() >> 20, bc.getStartIjkl() >> 20); // from row start to row presetQueens
bc.getStart(), bc.getStart()); // from row start to row presetQueens
currentSize = constellations.size();

// 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.getStartIjkl() | bc.getIjkl());
c.setStartIjkl(c.getStart() | bc.getIjkl());
c.setId(bc.getId());
}
}
Expand Down

0 comments on commit 7e38b18

Please sign in to comment.