This commit is contained in:
@@ -90,29 +90,23 @@ public class RenderableMultidoku {
|
||||
}
|
||||
|
||||
private static Coordinate getMaxSudokuCoordinate(Map<Sudoku, Coordinate> sudokusOffset) {
|
||||
Coordinate maxCoordinate = null;
|
||||
Sudoku maxSudoku = null;
|
||||
float maxDistanceSquared = 0;
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
Sudoku lastSudoku = null;
|
||||
for (var entry : sudokusOffset.entrySet()) {
|
||||
Coordinate coordinate = entry.getValue();
|
||||
float distanceSquared = coordinate.getX() * coordinate.getX() + coordinate.getY() * coordinate.getY();
|
||||
if (maxCoordinate == null) {
|
||||
maxCoordinate = coordinate;
|
||||
maxDistanceSquared = distanceSquared;
|
||||
maxSudoku = entry.getKey();
|
||||
if (coordinate.getX() > maxX)
|
||||
maxX = coordinate.getX();
|
||||
if (coordinate.getY() > maxY)
|
||||
maxY = coordinate.getY();
|
||||
lastSudoku = entry.getKey();
|
||||
}
|
||||
|
||||
if (distanceSquared > maxDistanceSquared) {
|
||||
maxDistanceSquared = distanceSquared;
|
||||
maxSudoku = entry.getKey();
|
||||
maxCoordinate = coordinate;
|
||||
}
|
||||
}
|
||||
Coordinate maxCoordinate = new Coordinate(maxX, maxY);
|
||||
// tous les sudokus sont censés faire la même taille
|
||||
int sudokuSize = lastSudoku.getSize();
|
||||
|
||||
int blockWidth = maxSudoku.getBlockWidth();
|
||||
int blockHeight = maxSudoku.getSize() / blockWidth;
|
||||
|
||||
return new Coordinate(maxCoordinate.getX() + maxSudoku.getSize(), maxCoordinate.getY() + maxSudoku.getSize());
|
||||
return new Coordinate(maxCoordinate.getX() + sudokuSize, maxCoordinate.getY() + sudokuSize);
|
||||
}
|
||||
|
||||
public static RenderableMultidoku fromMultidoku(MultiDoku doku) {
|
||||
|
||||
Reference in New Issue
Block a user