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