diff options
author | Adam NAILI | 2018-01-14 22:12:26 +0100 |
---|---|---|
committer | Adam NAILI | 2018-01-14 22:12:26 +0100 |
commit | 36d9bdb9ea9ae1447fd836735be93b4f96b28b0f (patch) | |
tree | eefb1e39539accc6fe0a4f2e72d81ce8275497bd /src | |
parent | d1c6b2f6a9fe6af75f1668e25d96ec4380f69f76 (diff) | |
parent | e79dd7a94448467b1a5582a47b84cd3dc320f54d (diff) | |
download | wallj-36d9bdb9ea9ae1447fd836735be93b4f96b28b0f.tar.gz |
Merge branch 'master' of https://github.com/pacien/upem-java-wallj
Diffstat (limited to 'src')
-rw-r--r-- | src/docs/user.md | 18 | ||||
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/board/BoardValidator.java | 3 | ||||
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/model/BlockType.java | 2 | ||||
-rw-r--r-- | src/main/resources/maps/level0.txt | 13 | ||||
-rw-r--r-- | src/main/resources/maps/level1.txt | 13 | ||||
-rw-r--r-- | src/main/resources/maps/level2.txt | 13 | ||||
-rw-r--r-- | src/main/resources/maps/level3.txt | 13 | ||||
-rw-r--r-- | src/test/resources/maps/bigValid.txt | 2 |
8 files changed, 65 insertions, 12 deletions
diff --git a/src/docs/user.md b/src/docs/user.md index 735daf5..cba47eb 100644 --- a/src/docs/user.md +++ b/src/docs/user.md | |||
@@ -69,8 +69,8 @@ Entity type Appearance Pushable by bomb Traversable by robot | |||
69 | ----------- ------------ ---------------- -------------------- | 69 | ----------- ------------ ---------------- -------------------- |
70 | Wall Black square No No | 70 | Wall Black square No No |
71 | Trash can Red square No No | 71 | Trash can Red square No No |
72 | Bomb Black disk No No | ||
72 | Free Empty No Yes | 73 | Free Empty No Yes |
73 | Bomb Black disk No Yes | ||
74 | Garbage Brown disk Yes Yes | 74 | Garbage Brown disk Yes Yes |
75 | Robot Blue disk / / | 75 | Robot Blue disk / / |
76 | 76 | ||
@@ -105,8 +105,8 @@ Wall W Yes No | |||
105 | A world is defined as valid if its blocks fulfill the following criteria: | 105 | A world is defined as valid if its blocks fulfill the following criteria: |
106 | 106 | ||
107 | * The bounding box of the defined world must be made of bounding blocks. | 107 | * The bounding box of the defined world must be made of bounding blocks. |
108 | * The interior space formed by bounding blocks must be unique and simple. | 108 | * The interior space formed by traversable blocks must be unique and simple. |
109 | * Reachable blocks are either adjacent or belong to the interior space. | 109 | * Reachable blocks are either adjacent or belonging to the interior space. |
110 | * The world must contain at least one trash can and one garbage block. | 110 | * The world must contain at least one trash can and one garbage block. |
111 | * The world must have enough free tiles to contain all droppable bombs. | 111 | * The world must have enough free tiles to contain all droppable bombs. |
112 | 112 | ||
@@ -118,11 +118,11 @@ The validity of a world may not guaranty the solvability of the puzzle. | |||
118 | 118 | ||
119 | __Example of invalid world definition:__ | 119 | __Example of invalid world definition:__ |
120 | ``` | 120 | ``` |
121 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | 121 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW W |
122 | W W W | 122 | W W W WWW W |
123 | W W W T | 123 | W W W WTW W |
124 | WWWWWWWWWW W | 124 | WWWWWWWWWW W WWW W |
125 | W W W | 125 | W W W W |
126 | W W WWWWWWWWWWW | 126 | W W WWWWWWWWWWW |
127 | WWWWWWWWWW W | 127 | WWWWWWWWWW W |
128 | W W W | 128 | W W W |
@@ -137,7 +137,7 @@ W WWWWWWWWWWW | |||
137 | W WWWWWWWWWWW | 137 | W WWWWWWWWWWW |
138 | T WWWWWWWWWW WWWWWWWWWWW | 138 | T WWWWWWWWWW WWWWWWWWWWW |
139 | T WWWWWWWWWW GGGGGGGGGGGGG WWWWWWWWWWW | 139 | T WWWWWWWWWW GGGGGGGGGGGGG WWWWWWWWWWW |
140 | T WWWWWWWWWW GGGGGGGG G WWWWWWWWWWW | 140 | T WWWWWWWWWW GGGGGGGG WWWWWWWWWWW |
141 | T WWWWWWWWWW GGGGGGGGGGGGG W | 141 | T WWWWWWWWWW GGGGGGGGGGGGG W |
142 | W W W | 142 | W W W |
143 | W W W | 143 | W W W |
diff --git a/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java b/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java index e238955..e95446b 100644 --- a/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java +++ b/src/main/java/fr/umlv/java/wallj/board/BoardValidator.java | |||
@@ -91,7 +91,8 @@ public class BoardValidator { | |||
91 | .filter(blockEntry -> blockEntry.getValue().mustBeReachable()) | 91 | .filter(blockEntry -> blockEntry.getValue().mustBeReachable()) |
92 | .allMatch(blockEntry -> blockEntry.getKey().neighbors().stream() | 92 | .allMatch(blockEntry -> blockEntry.getKey().neighbors().stream() |
93 | .filter(neighbor -> inBoard(dim, neighbor)) | 93 | .filter(neighbor -> inBoard(dim, neighbor)) |
94 | .anyMatch(neighbor -> b.getBlockTypeAt(neighbor).isTraversable())); | 94 | .anyMatch(neighbor -> b.getBlockTypeAt(neighbor).isTraversable() || |
95 | b.getBlockTypeAt(neighbor).isMovableByExplosion())); | ||
95 | } | 96 | } |
96 | 97 | ||
97 | /** | 98 | /** |
diff --git a/src/main/java/fr/umlv/java/wallj/model/BlockType.java b/src/main/java/fr/umlv/java/wallj/model/BlockType.java index 9051715..9c5d4f5 100644 --- a/src/main/java/fr/umlv/java/wallj/model/BlockType.java +++ b/src/main/java/fr/umlv/java/wallj/model/BlockType.java | |||
@@ -10,7 +10,7 @@ public enum BlockType { | |||
10 | FREE(false, true, true, false), | 10 | FREE(false, true, true, false), |
11 | WALL(true, false, false, false), | 11 | WALL(true, false, false, false), |
12 | TRASH(true, true, false, false), | 12 | TRASH(true, true, false, false), |
13 | GARBAGE(false, true, true, true), | 13 | GARBAGE(false, true, false, true), |
14 | ROBOT(false, false, true, false), | 14 | ROBOT(false, false, true, false), |
15 | BOMB(false, false, true, false); | 15 | BOMB(false, false, true, false); |
16 | 16 | ||
diff --git a/src/main/resources/maps/level0.txt b/src/main/resources/maps/level0.txt new file mode 100644 index 0000000..aa53f62 --- /dev/null +++ b/src/main/resources/maps/level0.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | ||
2 | W W | ||
3 | T T | ||
4 | T T | ||
5 | T T | ||
6 | T G T | ||
7 | T G T | ||
8 | T G T | ||
9 | T T | ||
10 | T T | ||
11 | T T | ||
12 | W W | ||
13 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW \ No newline at end of file | ||
diff --git a/src/main/resources/maps/level1.txt b/src/main/resources/maps/level1.txt new file mode 100644 index 0000000..7e8e3fb --- /dev/null +++ b/src/main/resources/maps/level1.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | ||
2 | W W | ||
3 | W W | ||
4 | W W | ||
5 | W W W | ||
6 | W G WT W | ||
7 | W G WT W | ||
8 | W G WT W | ||
9 | W W W | ||
10 | W W | ||
11 | W W | ||
12 | W W | ||
13 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW \ No newline at end of file | ||
diff --git a/src/main/resources/maps/level2.txt b/src/main/resources/maps/level2.txt new file mode 100644 index 0000000..bb41492 --- /dev/null +++ b/src/main/resources/maps/level2.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | ||
2 | W W | ||
3 | W WW W | ||
4 | W G W W | ||
5 | W W | ||
6 | W TTT G W | ||
7 | W W TWT W | ||
8 | W TTT W | ||
9 | W W W | ||
10 | W WW W | ||
11 | W G WW W W | ||
12 | W W | ||
13 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW \ No newline at end of file | ||
diff --git a/src/main/resources/maps/level3.txt b/src/main/resources/maps/level3.txt new file mode 100644 index 0000000..08f8aef --- /dev/null +++ b/src/main/resources/maps/level3.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | ||
2 | W W | ||
3 | W GGGG G G G GGGGG W | ||
4 | W G G G G G W | ||
5 | W G GG G GGGGG GGG W | ||
6 | W G G G G G G W | ||
7 | W GGGG GGGG G G G W | ||
8 | W W | ||
9 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWW W | ||
10 | W W | ||
11 | W T W | ||
12 | W W | ||
13 | WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW \ No newline at end of file | ||
diff --git a/src/test/resources/maps/bigValid.txt b/src/test/resources/maps/bigValid.txt index 45bcacf..80c83fc 100644 --- a/src/test/resources/maps/bigValid.txt +++ b/src/test/resources/maps/bigValid.txt | |||
@@ -3,7 +3,7 @@ W WWWWWWWWWWW | |||
3 | W WWWWWWWWWWW | 3 | W WWWWWWWWWWW |
4 | T WWWWWWWWWW WWWWWWWWWWW | 4 | T WWWWWWWWWW WWWWWWWWWWW |
5 | T WWWWWWWWWW GGGGGGGGGGGGG WWWWWWWWWWW | 5 | T WWWWWWWWWW GGGGGGGGGGGGG WWWWWWWWWWW |
6 | T WWWWWWWWWW GGGGGGGG G WWWWWWWWWWW | 6 | T WWWWWWWWWW GGGGGGGG WWWWWWWWWWW |
7 | T WWWWWWWWWW GGGGGGGGGGGGG W | 7 | T WWWWWWWWWW GGGGGGGGGGGGG W |
8 | W W W | 8 | W W W |
9 | W W W | 9 | W W W |