summaryrefslogtreecommitdiff
path: root/src/ch
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-11-24 11:11:17 +0100
committerPacien TRAN-GIRARD2015-11-24 11:11:17 +0100
commitbc477506342411e9156b3230d847cb92bcb8e5f9 (patch)
treed952a5d14dccef38bfba3f8e27bfe10ea65d446a /src/ch
parent903553fe9e03e4af75eb7f8547e08b480bc58ec4 (diff)
downloadmaze-solver-bc477506342411e9156b3230d847cb92bcb8e5f9.tar.gz
Reformat code
Diffstat (limited to 'src/ch')
-rw-r--r--src/ch/epfl/maze/graphics/Animation.java9
-rw-r--r--src/ch/epfl/maze/graphics/Display.java12
-rw-r--r--src/ch/epfl/maze/graphics/GraphicComponent.java8
-rw-r--r--src/ch/epfl/maze/main/Console.java5
-rw-r--r--src/ch/epfl/maze/main/Program.java5
-rw-r--r--src/ch/epfl/maze/physical/Animal.java7
-rw-r--r--src/ch/epfl/maze/physical/GhostPredator.java4
-rw-r--r--src/ch/epfl/maze/physical/Maze.java6
-rw-r--r--src/ch/epfl/maze/physical/World.java16
-rw-r--r--src/ch/epfl/maze/physical/pacman/Pinky.java3
-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
-rw-r--r--src/ch/epfl/maze/simulation/DaedalusSimulation.java6
-rw-r--r--src/ch/epfl/maze/simulation/MazeSimulation.java4
-rw-r--r--src/ch/epfl/maze/simulation/Simulation.java10
-rw-r--r--src/ch/epfl/maze/tests/AnimalTest.java7
-rw-r--r--src/ch/epfl/maze/tests/Competition.java8
-rw-r--r--src/ch/epfl/maze/tests/DaedalusTest.java4
-rw-r--r--src/ch/epfl/maze/tests/GhostsTest.java8
-rw-r--r--src/ch/epfl/maze/tests/MazeTest.java4
-rw-r--r--src/ch/epfl/maze/tests/WorldTest.java16
-rw-r--r--src/ch/epfl/maze/tests/ZooTest.java11
-rw-r--r--src/ch/epfl/maze/util/Action.java8
-rw-r--r--src/ch/epfl/maze/util/Direction.java12
-rw-r--r--src/ch/epfl/maze/util/LabyrinthGenerator.java21
-rw-r--r--src/ch/epfl/maze/util/Statistics.java8
-rw-r--r--src/ch/epfl/maze/util/Vector2D.java16
29 files changed, 29 insertions, 205 deletions
diff --git a/src/ch/epfl/maze/graphics/Animation.java b/src/ch/epfl/maze/graphics/Animation.java
index ce80c78..a00b6b2 100644
--- a/src/ch/epfl/maze/graphics/Animation.java
+++ b/src/ch/epfl/maze/graphics/Animation.java
@@ -22,7 +22,6 @@ import java.util.TreeMap;
22 * 22 *
23 * @author Pacien TRAN-GIRARD 23 * @author Pacien TRAN-GIRARD
24 */ 24 */
25
26public final class Animation { 25public final class Animation {
27 26
28 /** 27 /**
@@ -62,7 +61,6 @@ public final class Animation {
62 * @param animals The {@code List} of animals that will be shown on the first 61 * @param animals The {@code List} of animals that will be shown on the first
63 * frame 62 * frame
64 */ 63 */
65
66 public Animation(List<Animal> animals) { 64 public Animation(List<Animal> animals) {
67 mGraphMap = new TreeMap<Integer, GraphicComponent>(); 65 mGraphMap = new TreeMap<Integer, GraphicComponent>();
68 mImages = new HashMap<String, BufferedImage>(); 66 mImages = new HashMap<String, BufferedImage>();
@@ -94,7 +92,6 @@ public final class Animation {
94 * @param id Unique identifier for animal 92 * @param id Unique identifier for animal
95 * @param action Action that animal needs to perform 93 * @param action Action that animal needs to perform
96 */ 94 */
97
98 public void update(Animal animal, int id, Action action) { 95 public void update(Animal animal, int id, Action action) {
99 // sanity checks 96 // sanity checks
100 if (action == null) { 97 if (action == null) {
@@ -123,7 +120,6 @@ public final class Animation {
123 * 120 *
124 * @param id Identifier of animal to kill 121 * @param id Identifier of animal to kill
125 */ 122 */
126
127 public void updateDying(int id) { 123 public void updateDying(int id) {
128 GraphicComponent graphComp = mGraphMap.get(id); 124 GraphicComponent graphComp = mGraphMap.get(id);
129 if (graphComp != null) { 125 if (graphComp != null) {
@@ -135,7 +131,6 @@ public final class Animation {
135 * Notifies the animation that updates were done, and that it can start 131 * Notifies the animation that updates were done, and that it can start
136 * animating from now. 132 * animating from now.
137 */ 133 */
138
139 public void doneUpdating() { 134 public void doneUpdating() {
140 mDone = false; 135 mDone = false;
141 } 136 }
@@ -149,7 +144,6 @@ public final class Animation {
149 * @param targetWindow The window on which the graphic components will be painted 144 * @param targetWindow The window on which the graphic components will be painted
150 * (assumed non-null) 145 * (assumed non-null)
151 */ 146 */
152
153 public void paint(float dt, Graphics2D g, ImageObserver targetWindow) { 147 public void paint(float dt, Graphics2D g, ImageObserver targetWindow) {
154 mRatio += dt; 148 mRatio += dt;
155 if (mRatio > 1) { 149 if (mRatio > 1) {
@@ -181,7 +175,6 @@ public final class Animation {
181 * 175 *
182 * @return <b>true</b> if the animation is done, <b>false</b> otherwise 176 * @return <b>true</b> if the animation is done, <b>false</b> otherwise
183 */ 177 */
184
185 public boolean isDone() { 178 public boolean isDone() {
186 return mDone; 179 return mDone;
187 } 180 }
@@ -192,7 +185,6 @@ public final class Animation {
192 * number of frames will still be painted to prevent the screen from 185 * number of frames will still be painted to prevent the screen from
193 * flashing. 186 * flashing.
194 */ 187 */
195
196 public void reset(List<Animal> animals) { 188 public void reset(List<Animal> animals) {
197 mGraphMap.clear(); 189 mGraphMap.clear();
198 if (animals != null) { 190 if (animals != null) {
@@ -225,7 +217,6 @@ public final class Animation {
225 * @param animal Animal whose image needs to be loaded or returned 217 * @param animal Animal whose image needs to be loaded or returned
226 * @return The buffered image of the animal 218 * @return The buffered image of the animal
227 */ 219 */
228
229 private BufferedImage loadImage(Animal animal) { 220 private BufferedImage loadImage(Animal animal) {
230 // path = "img/superclass/class.png" 221 // path = "img/superclass/class.png"
231 String superClassName = animal.getClass().getSuperclass().getSimpleName(); 222 String superClassName = animal.getClass().getSuperclass().getSimpleName();
diff --git a/src/ch/epfl/maze/graphics/Display.java b/src/ch/epfl/maze/graphics/Display.java
index 2fddcf1..baacefa 100644
--- a/src/ch/epfl/maze/graphics/Display.java
+++ b/src/ch/epfl/maze/graphics/Display.java
@@ -17,7 +17,6 @@ import java.util.Map;
17/** 17/**
18 * Handles the display of a {@code Simulation} on a window. 18 * Handles the display of a {@code Simulation} on a window.
19 */ 19 */
20
21public final class Display implements Runnable { 20public final class Display implements Runnable {
22 21
23 /* constants */ 22 /* constants */
@@ -58,7 +57,6 @@ public final class Display implements Runnable {
58 * 57 *
59 * @param simulation A {@code Simulation} to display 58 * @param simulation A {@code Simulation} to display
60 */ 59 */
61
62 public Display(Simulation simulation) { 60 public Display(Simulation simulation) {
63 // sanity check 61 // sanity check
64 if (simulation == null) { 62 if (simulation == null) {
@@ -124,7 +122,6 @@ public final class Display implements Runnable {
124 * 122 *
125 * @param debug The new debug value 123 * @param debug The new debug value
126 */ 124 */
127
128 public void setDebug(boolean debug) { 125 public void setDebug(boolean debug) {
129 mDebug = debug; 126 mDebug = debug;
130 mShowGrid = debug; 127 mShowGrid = debug;
@@ -135,7 +132,6 @@ public final class Display implements Runnable {
135 /** 132 /**
136 * Creates frame window. 133 * Creates frame window.
137 */ 134 */
138
139 private void createWindow() { 135 private void createWindow() {
140 // actual window 136 // actual window
141 mFrame = new JFrame("Maze solver simulation"); 137 mFrame = new JFrame("Maze solver simulation");
@@ -163,7 +159,6 @@ public final class Display implements Runnable {
163 /** 159 /**
164 * Creates canvas. 160 * Creates canvas.
165 */ 161 */
166
167 private void createCanvas() { 162 private void createCanvas() {
168 // actual canvas 163 // actual canvas
169 mCanvas = new Canvas(); 164 mCanvas = new Canvas();
@@ -183,7 +178,6 @@ public final class Display implements Runnable {
183 /** 178 /**
184 * Creates menu. 179 * Creates menu.
185 */ 180 */
186
187 private void createMenu() { 181 private void createMenu() {
188 // creates menu bar 182 // creates menu bar
189 mMenuBar = new JMenuBar(); 183 mMenuBar = new JMenuBar();
@@ -371,7 +365,6 @@ public final class Display implements Runnable {
371 * 365 *
372 * @param g The graphics on which the labyrinth will be drawn 366 * @param g The graphics on which the labyrinth will be drawn
373 */ 367 */
374
375 private void drawLabyrinth(Graphics2D g) { 368 private void drawLabyrinth(Graphics2D g) {
376 World world = mSimulation.getWorld(); 369 World world = mSimulation.getWorld();
377 370
@@ -405,7 +398,6 @@ public final class Display implements Runnable {
405 * @param width Width of graphics 398 * @param width Width of graphics
406 * @param height Height of graphics 399 * @param height Height of graphics
407 */ 400 */