aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/fr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/fr')
-rw-r--r--src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java b/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java
index 3af4679..be615b7 100644
--- a/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java
+++ b/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java
@@ -7,6 +7,7 @@ import java.io.IOException;
7import java.net.URISyntaxException; 7import java.net.URISyntaxException;
8import java.nio.file.Path; 8import java.nio.file.Path;
9import java.nio.file.Paths; 9import java.nio.file.Paths;
10import java.util.ArrayList;
10import java.util.List; 11import java.util.List;
11 12
12/** 13/**
@@ -19,8 +20,10 @@ final class PathFinderTest {
19 } 20 }
20 21
21 private boolean isPathConnected(List<TileVec2> path) { 22 private boolean isPathConnected(List<TileVec2> path) {
22 for (int i = 1; i < path.size(); ++i) { 23 List<TileVec2> runPath = new ArrayList<>(path);
23 TileVec2 predecessor = path.get(i - 1), current = path.get(i); 24
25 for (int i = 1; i < runPath.size(); ++i) {
26 TileVec2 predecessor = runPath.get(i - 1), current = runPath.get(i);
24 27
25 if (Math.abs(predecessor.getCol() - current.getCol()) > 1 || 28 if (Math.abs(predecessor.getCol() - current.getCol()) > 1 ||
26 Math.abs(predecessor.getRow() - current.getRow()) > 1) return false; 29 Math.abs(predecessor.getRow() - current.getRow()) > 1) return false;