summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/physical/World.java
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-11-21 10:44:42 +0100
committerPacien TRAN-GIRARD2015-11-21 10:44:42 +0100
commit90bd766f361083f6fd9e39ff080c83fcc606832f (patch)
treedf81a931c9565a4b227068680087f58fdace1859 /src/ch/epfl/maze/physical/World.java
parent655ac88f4e73b2df532a451aedf5a561ea1b0d2c (diff)
downloadmaze-solver-90bd766f361083f6fd9e39ff080c83fcc606832f.tar.gz
Reformat imported code
Diffstat (limited to 'src/ch/epfl/maze/physical/World.java')
-rw-r--r--src/ch/epfl/maze/physical/World.java259
1 files changed, 126 insertions, 133 deletions
diff --git a/src/ch/epfl/maze/physical/World.java b/src/ch/epfl/maze/physical/World.java
index 34bf334..d6ac1de 100644
--- a/src/ch/epfl/maze/physical/World.java
+++ b/src/ch/epfl/maze/physical/World.java
@@ -1,146 +1,139 @@
1package ch.epfl.maze.physical; 1package ch.epfl.maze.physical;
2 2
3import java.util.List;
4
5import ch.epfl.maze.util.Direction; 3import ch.epfl.maze.util.Direction;
6import ch.epfl.maze.util.Vector2D; 4import ch.epfl.maze.util.Vector2D;
7 5
6import java.util.List;
7
8/** 8/**
9 * World that is represented by a labyrinth of tiles in which an {@code Animal} 9 * World that is represented by a labyrinth of tiles in which an {@code Animal}
10 * can move. 10 * can move.
11 *
12 */ 11 */
13 12
14public abstract class World { 13public abstract class World {
15 14
16 /* tiles constants */ 15 /* tiles constants */
17 public static final int FREE = 0; 16 public static final int FREE = 0;
18 public static final int WALL = 1; 17 public static final int WALL = 1;
19 public static final int START = 2; 18 public static final int START = 2;
20 public static final int EXIT = 3; 19 public static final int EXIT = 3;
21 public static final int NOTHING = -1; 20 public static final int NOTHING = -1;
22 21
23 /** 22 /**
24 * Constructs a new world with a labyrinth. The labyrinth must be rectangle. 23 * Constructs a new world with a labyrinth. The labyrinth must be rectangle.
25 * 24 *
26 * @param labyrinth 25 * @param labyrinth Structure of the labyrinth, an NxM array of tiles
27 * Structure of the labyrinth, an NxM array of tiles 26 */
28 */ 27
29 28 public World(int[][] labyrinth) {
30 public World(int[][] labyrinth) { 29 // TODO
31 // TODO 30 }
32 } 31
33 32 /**
34 /** 33 * Determines whether the labyrinth has been solved by every animal.
35 * Determines whether the labyrinth has been solved by every animal. 34 *
36 * 35 * @return <b>true</b> if no more moves can be made, <b>false</b> otherwise
37 * @return <b>true</b> if no more moves can be made, <b>false</b> otherwise 36 */
38 */ 37
39 38 abstract public boolean isSolved();
40 abstract public boolean isSolved(); 39
41 40 /**
42 /** 41 * Resets the world as when it was instantiated.
43 * Resets the world as when it was instantiated. 42 */
44 */ 43
45 44 abstract public void reset();
46 abstract public void reset(); 45
47 46 /**
48 /** 47 * Returns a copy of the list of all current animals in the world.
49 * Returns a copy of the list of all current animals in the world. 48 *
50 * 49 * @return A list of all animals in the world
51 * @return A list of all animals in the world 50 */
52 */ 51
53 52 abstract public List<Animal> getAnimals();
54 abstract public List<Animal> getAnimals(); 53
55 54 /**
56 /** 55 * Checks in a safe way the tile number at position (x, y) in the labyrinth.
57 * Checks in a safe way the tile number at position (x, y) in the labyrinth. 56 *
58 * 57 * @param x Horizontal coordinate
59 * @param x 58 * @param y Vertical coordinate
60 * Horizontal coordinate 59 * @return The tile number at position (x, y), or the NONE tile if x or y is
61 * @param y 60 * incorrect.
62 * Vertical coordinate 61 */
63 * @return The tile number at position (x, y), or the NONE tile if x or y is 62
64 * incorrect. 63 public final int getTile(int x, int y) {
65 */ 64 // TODO
66 65 return 0;
67 public final int getTile(int x, int y) { 66 }
68 // TODO 67
69 return 0; 68 /**
70 } 69 * Determines if coordinates are free to walk on.
71 70 *
72 /** 71 * @param x Horizontal coordinate
73 * Determines if coordinates are free to walk on. 72 * @param y Vertical coordinate
74 * 73 * @return <b>true</b> if an animal can walk on tile, <b>false</b> otherwise
75 * @param x 74 */
76 * Horizontal coordinate 75
77 * @param y 76 public final boolean isFree(int x, int y) {
78 * Vertical coordinate 77 // TODO
79 * @return <b>true</b> if an animal can walk on tile, <b>false</b> otherwise 78 return false;
80 */ 79 }
81 80
82 public final boolean isFree(int x, int y) { 81 /**
83 // TODO 82 * Computes and returns the available choices for a position in the
84 return false; 83 * labyrinth. The result will be typically used by {@code Animal} in
85 } 84 * {@link ch.epfl.maze.physical.Animal#move(Direction[]) move(Direction[])}
86 85 *
87 /** 86 * @param position A position in the maze
88 * Computes and returns the available choices for a position in the 87 * @return An array of all available choices at a position
89 * labyrinth. The result will be typically used by {@code Animal} in 88 */
90 * {@link ch.epfl.maze.physical.Animal#move(Direction[]) move(Direction[])} 89
91 * 90 public final Direction[] getChoices(Vector2D position) {
92 * @param position 91 // TODO
93 * A position in the maze 92 return null;
94 * @return An array of all available choices at a position 93 }
95 */ 94
96 95 /**
97 public final Direction[] getChoices(Vector2D position) { 96 * Returns horizontal length of labyrinth.
98 // TODO 97 *
99 return null; 98 * @return The horizontal length of the labyrinth
100 } 99 */
101 100
102 /** 101 public final int getWidth() {
103 * Returns horizontal length of labyrinth. 102 // TODO
104 * 103 return 0;
105 * @return The horizontal length of the labyrinth 104 }
106 */ 105
107 106 /**
108 public final int getWidth() { 107 * Returns vertical length of labyrinth.
109 // TODO 108 *
110 return 0; 109 * @return The vertical length of the labyrinth
111 } 110 */
112 111
113 /** 112 public final int getHeight() {
114 * Returns vertical length of labyrinth. 113 // TODO
115 * 114 return 0;
116 * @return The vertical length of the labyrinth 115 }
117 */ 116
118 117 /**
119 public final int getHeight() { 118 * Returns the entrance of the labyrinth at which animals should begin when
120 // TODO 119 * added.
121 return 0; 120 *
122 } 121 * @return Start position of the labyrinth, null if none.
123 122 */
124 /** 123
125 * Returns the entrance of the labyrinth at which animals should begin when 124 public final Vector2D getStart() {
126 * added. 125 // TODO
127 * 126 return null;
128 * @return Start position of the labyrinth, null if none. 127 }
129 */ 128
130 129 /**
131 public final Vector2D getStart() { 130 * Returns the exit of the labyrinth at which animals should be removed.
132 // TODO 131 *
133 return null; 132 * @return Exit position of the labyrinth, null if none.
134 } 133 */
135 134
136 /** 135 public final Vector2D getExit() {
137 * Returns the exit of the labyrinth at which animals should be removed. 136 // TODO
138 * 137 return null;
139 * @return Exit position of the labyrinth, null if none. 138 }
140 */
141
142 public final Vector2D getExit() {
143 // TODO
144 return null;
145 }
146} 139}