Skip to content

Commit

Permalink
Add Clojure support
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ-Atkinson committed Jun 20, 2017
1 parent 94843e0 commit 5cc1c32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/jatkin/splixkoth/ppcg/SplixSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class SplixSettings {
public static final int gameIterationsCount = 2000;
public static final int pointsForKill = 300;
public static final int boardDims = 200;
public static final int boardDims = 100;

// must be square for the ui to work correctly
public static final Point2D viewingAreaSize = new Point2D(20, 20);
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/jatkin/splixkoth/ppcg/game/SplixBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,18 @@ public void fillPlayerCapturedArea(SplixPlayer whoToCheck, Set<Point2D> areaChan

for (Point2D pt : checkSpace) {
Set<Point2D> points = floodSearchHelperFillPlayerCapturedArea(pt, whoToCheck, previouslyVisitedLocations);
if (points != null) {// valid fill that didn't hit wall
MutableList<Point2D> border = getAdjacent(points);

// Interesting edge case: A player can completely surround another, and when the 2nd player
// exits his area to make a trail and claim more area, the first player would originally
// capture all of the 2nd player's land. This code removes that edge case.
// ref: https://chat.stackexchange.com/transcript/message/38228281#38228281
boolean canFillIn = border.toSet().select(p2d -> {
SplixPlayer claimer = get(p2d).getClaimer();
return claimer != null && claimer != whoToCheck;
}).isEmpty();

if (points != null && canFillIn) {// valid fill that didn't hit wall
points.forEach(x -> get(x).setOwner(whoToCheck));
}
}
Expand Down

0 comments on commit 5cc1c32

Please sign in to comment.