-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring and slight performance improvement
- Loading branch information
Showing
5 changed files
with
44 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/com/samabcde/puzzlesolver/solve/priority/BlockPositionComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.samabcde.puzzlesolver.solve.priority; | ||
|
||
import com.samabcde.puzzlesolver.component.BlockPosition; | ||
import com.samabcde.puzzlesolver.component.BlockPuzzle; | ||
|
||
import java.util.Comparator; | ||
|
||
public record BlockPositionComparator(BlockPuzzle blockPuzzle) implements Comparator<BlockPosition> { | ||
|
||
@Override | ||
public int compare(BlockPosition arg0, BlockPosition arg1) { | ||
int compareIntersectScore = Integer.compare(arg0.getIntersectScore(blockPuzzle), arg1.getIntersectScore(blockPuzzle)); | ||
if (compareIntersectScore != 0) { | ||
return compareIntersectScore; | ||
} | ||
return Integer.compare(arg0.id, arg1.id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/main/java/com/samabcde/puzzlesolver/solve/state/BoardFillState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters