summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/physical/zoo
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/maze/physical/zoo')
-rw-r--r--src/ch/epfl/maze/physical/zoo/Hamster.java5
-rw-r--r--src/ch/epfl/maze/physical/zoo/Monkey.java5
-rw-r--r--src/ch/epfl/maze/physical/zoo/Panda.java2
-rw-r--r--src/ch/epfl/maze/physical/zoo/SpaceInvader.java4
4 files changed, 4 insertions, 12 deletions
diff --git a/src/ch/epfl/maze/physical/zoo/Hamster.java b/src/ch/epfl/maze/physical/zoo/Hamster.java
index 3c903f5..7fa0b0d 100644
--- a/src/ch/epfl/maze/physical/zoo/Hamster.java
+++ b/src/ch/epfl/maze/physical/zoo/Hamster.java
@@ -16,7 +16,6 @@ import java.util.stream.Collectors;
16 * 16 *
17 * @author Pacien TRAN-GIRARD 17 * @author Pacien TRAN-GIRARD
18 */ 18 */
19
20public class Hamster extends ProbabilisticAnimal { 19public class Hamster extends ProbabilisticAnimal {
21 20
22 private final List<Vector2D> deadPaths; 21 private final List<Vector2D> deadPaths;
@@ -26,7 +25,6 @@ public class Hamster extends ProbabilisticAnimal {
26 * 25 *
27 * @param position Starting position of the hamster in the labyrinth 26 * @param position Starting position of the hamster in the labyrinth
28 */ 27 */
29
30 public Hamster(Vector2D position) { 28 public Hamster(Vector2D position) {
31 super(position); 29 super(position);
32 this.deadPaths = new ArrayList<>(); 30 this.deadPaths = new ArrayList<>();
@@ -38,7 +36,6 @@ public class Hamster extends ProbabilisticAnimal {
38 * @param choices An array of choices 36 * @param choices An array of choices
39 * @return An array of smart choices 37 * @return An array of smart choices
40 */ 38 */
41
42 private Direction[] excludeDeadPaths(Direction[] choices) { 39 private Direction[] excludeDeadPaths(Direction[] choices) {
43 return (new ArrayList<>(Arrays.asList(choices))) 40 return (new ArrayList<>(Arrays.asList(choices)))
44 .stream() 41 .stream()
@@ -51,7 +48,6 @@ public class Hamster extends ProbabilisticAnimal {
51 * Moves without retracing directly its steps and by avoiding the dead-ends 48 * Moves without retracing directly its steps and by avoiding the dead-ends
52 * it learns during its journey. 49 * it learns during its journey.
53 */ 50 */
54
55 @Override 51 @Override
56 public Direction move(Direction[] choices) { 52 public Direction move(Direction[] choices) {
57 Direction[] smartChoices = this.excludeDeadPaths(choices); 53 Direction[] smartChoices = this.excludeDeadPaths(choices);
@@ -63,4 +59,5 @@ public class Hamster extends ProbabilisticAnimal {
63 public Animal copy() { 59 public Animal copy() {
64 return new Hamster(this.getPosition()); 60 return new Hamster(this.getPosition());
65 } 61 }
62
66} 63}
diff --git a/src/ch/epfl/maze/physical/zoo/Monkey.java b/src/ch/epfl/maze/physical/zoo/Monkey.java
index 7bcf090..196b028 100644
--- a/src/ch/epfl/maze/physical/zoo/Monkey.java
+++ b/src/ch/epfl/maze/physical/zoo/Monkey.java
@@ -13,7 +13,6 @@ import java.util.List;
13 * 13 *
14 * @author Pacien TRAN-GIRARD 14 * @author Pacien TRAN-GIRARD
15 */ 15 */
16
17public class Monkey extends Animal { 16public class Monkey extends Animal {
18 17
19 private Direction currentDirection; 18 private Direction currentDirection;
@@ -23,7 +22,6 @@ public class Monkey extends Animal {
23 * 22 *
24 * @param position Starting position of the monkey in the labyrinth 23 * @param position Starting position of the monkey in the labyrinth
25 */ 24 */
26
27 public Monkey(Vector2D position) { 25 public Monkey(Vector2D position) {
28 super(position); 26 super(position);
29 this.currentDirection = Direction.NONE; 27 this.currentDirection = Direction.NONE;
@@ -35,7 +33,6 @@ public class Monkey extends Animal {
35 * @param choices An array of possible directions 33 * @param choices An array of possible directions
36 * @return The currentDirection to take according to the "left paw rule" 34 * @return The currentDirection to take according to the "left paw rule"
37 */ 35 */
38
39 private Direction followLeft(Direction[] choices) { 36 private Direction followLeft(Direction[] choices) {
40 List<Direction> choiceList = new ArrayList<>(Arrays.asList(choices)); 37 List<Direction> choiceList = new ArrayList<>(Arrays.asList(choices));
41 Direction dir = this.currentDirection.rotateLeft(); 38 Direction dir = this.currentDirection.rotateLeft();
@@ -60,7 +57,6 @@ public class Monkey extends Animal {
60 /** 57 /**
61 * Moves according to the relative left wall that the monkey has to follow. 58 * Moves according to the relative left wall that the monkey has to follow.
62 */ 59 */
63
64 @Override 60 @Override
65 public Direction move(Direction[] choices) { 61 public Direction move(Direction[] choices) {
66 this.currentDirection = this.findDirection(choices); 62 this.currentDirection = this.findDirection(choices);
@@ -71,4 +67,5 @@ public class Monkey extends Animal {
71 public Animal copy() { 67 public Animal copy() {
72 return new Monkey(this.getPosition()); 68 return new Monkey(this.getPosition());
73 } 69 }
70
74} 71}
diff --git a/src/ch/epfl/maze/physical/zoo/Panda.java b/src/ch/epfl/maze/physical/zoo/Panda.java
index dc1198e..aa35efe 100644
--- a/src/ch/epfl/maze/physical/zoo/Panda.java
+++ b/src/ch/epfl/maze/physical/zoo/Panda.java
@@ -104,7 +104,7 @@ public class Panda extends ProbabilisticAnimal {
104 * avoiding intersections over-marking. 104 * avoiding intersections over-marking.
105 * 105 *
106 * @param choices An array of possible Directions 106 * @param choices An array of possible Directions
107 * @param choice The selected Direction 107 * @param choice The selected Direction
108 * @return T(the current position should be marked) 108 * @return T(the current position should be marked)
109 */ 109 */
110 private boolean shouldMarkCurrentPosition(Direction[] choices, Direction choice) { 110 private boolean shouldMarkCurrentPosition(Direction[] choices, Direction choice) {
diff --git a/src/ch/epfl/maze/physical/zoo/SpaceInvader.java b/src/ch/epfl/maze/physical/zoo/SpaceInvader.java
index f5963b1..d03d280 100644
--- a/src/ch/epfl/maze/physical/zoo/SpaceInvader.java
+++ b/src/ch/epfl/maze/physical/zoo/SpaceInvader.java
@@ -18,7 +18,6 @@ import ch.epfl.maze.util.Vector2D;
18 * 18 *
19 * @see ch.epfl.maze.tests.Competition Competition 19 * @see ch.epfl.maze.tests.Competition Competition
20 */ 20 */
21
22public class SpaceInvader extends Animal { 21public class SpaceInvader extends Animal {
23 22
24 /** 23 /**
@@ -26,7 +25,6 @@ public class SpaceInvader extends Animal {
26 * 25 *
27 * @param position Starting position of the mouse in the labyrinth 26 * @param position Starting position of the mouse in the labyrinth
28 */ 27 */
29
30 public SpaceInvader(Vector2D position) { 28 public SpaceInvader(Vector2D position) {
31 super(position); 29 super(position);
32 // TODO (bonus) 30 // TODO (bonus)
@@ -35,7 +33,6 @@ public class SpaceInvader extends Animal {
35 /** 33 /**
36 * Moves according to (... please complete with as many details as you can). 34 * Moves according to (... please complete with as many details as you can).
37 */ 35 */
38
39 @Override 36 @Override
40 public Direction move(Direction[] choices) { 37 public Direction move(Direction[] choices) {
41 // TODO (bonus) 38 // TODO (bonus)
@@ -47,4 +44,5 @@ public class SpaceInvader extends Animal {
47 // TODO (bonus) 44 // TODO (bonus)
48 return null; 45 return null;
49 } 46 }
47
50} 48}