aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ch/epfl/xblast/Cell.java10
-rw-r--r--src/ch/epfl/xblast/SubCell.java10
-rw-r--r--src/ch/epfl/xblast/server/GameState.java93
3 files changed, 109 insertions, 4 deletions
diff --git a/src/ch/epfl/xblast/Cell.java b/src/ch/epfl/xblast/Cell.java
index d31a889..098c19c 100644
--- a/src/ch/epfl/xblast/Cell.java
+++ b/src/ch/epfl/xblast/Cell.java
@@ -175,6 +175,16 @@ public final class Cell {
175 } 175 }
176 176
177 /** 177 /**
178 * Returns the hash code for this Cell, given by its row-major index.
179 *
180 * @return the hash code
181 */
182 @Override
183 public int hashCode() {
184 return 0; // TODO
185 }
186
187 /**
178 * Returns a String representation of the coordinates of the Cell. 188 * Returns a String representation of the coordinates of the Cell.
179 * 189 *
180 * @return a String representation of the coordinates of the Cell. 190 * @return a String representation of the coordinates of the Cell.
diff --git a/src/ch/epfl/xblast/SubCell.java b/src/ch/epfl/xblast/SubCell.java
index a95e65e..3b7fdb1 100644
--- a/src/ch/epfl/xblast/SubCell.java
+++ b/src/ch/epfl/xblast/SubCell.java
@@ -137,6 +137,16 @@ public final class SubCell {
137 } 137 }
138 138
139 /** 139 /**
140 * Returns the hash code of this SubCell, given by its row-major index.
141 *
142 * @return the hash code
143 */
144 @Override
145 public int hashCode() {
146 return 0; // TODO
147 }
148
149 /**
140 * Returns a String representation of the coordinates of the SubCell. 150 * Returns a String representation of the coordinates of the SubCell.
141 * 151 *
142 * @return a String representation of the coordinates of the SubCell. 152 * @return a String representation of the coordinates of the SubCell.
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index ef792b6..a415301 100644
--- a/src/ch/epfl/xblast/server/GameState.java
+++ b/src/ch/epfl/xblast/server/GameState.java
@@ -3,12 +3,10 @@ package ch.epfl.xblast.server;
3import ch.epfl.cs108.Sq; 3import ch.epfl.cs108.Sq;
4import ch.epfl.xblast.ArgumentChecker; 4import ch.epfl.xblast.ArgumentChecker;
5import ch.epfl.xblast.Cell; 5import ch.epfl.xblast.Cell;
6import ch.epfl.xblast.Direction;
6import ch.epfl.xblast.PlayerID; 7import ch.epfl.xblast.PlayerID;
7 8
8import java.util.ArrayList; 9import java.util.*;
9import java.util.List;
10import java.util.Objects;
11import java.util.Optional;
12import java.util.stream.Collectors; 10import java.util.stream.Collectors;
13import java.util.stream.Stream; 11import java.util.stream.Stream;
14 12
@@ -143,4 +141,91 @@ public final class GameState {
143 .collect(Collectors.toList()); 141 .collect(Collectors.toList());
144 } 142 }
145 143
144 /**
145 * Returns a mapping of Cells and their Bomb.
146 *
147 * @return the map of bombs
148 */
149 public Map<Cell, Bomb> bombedCells() {
150 return null; // TODO
151 }
152
153 /**
154 * Returns the set of cells which contains at least one explosion particle.
155 *
156 * @return the set of blasted cells
157 */
158 public Set<Cell> blastedCells() {
159 return null; // TODO
160 }
161
162 /**
163 * Computes and returns the game state for the next tick, given the current state and the given events.
164 *
165 * @param speedChangeEvents the speed change events
166 * @param bombDropEvents the bomb drop events
167 * @return the next game state
168 */
169 public GameState next(Map<PlayerID, Optional<Direction>> speedChangeEvents, Set<PlayerID> bombDropEvents) {
170 return null; // TODO
171 }
172
173 /**
174 * Computes and returns the next board state of the given board according to the given events.
175 *
176 * @param board0 the previous board
177 * @param consumedBonuses the set of consumed bonuses
178 * @param blastedCells1 the set of newly blasted cells
179 * @return the next board
180 */
181 private static Board nextBoard(Board board0, Set<Cell> consumedBonuses, Set<Cell> blastedCells1) {
182 return null; // TODO
183 }
184
185 /**
186 * Computes and returns the next player list given the current one and the given events and states.
187 *
188 * @param players0 the previous player list
189 * @param playerBonuses the map of player bonuses
190 * @param bombedCells1 the set of newly bombed cells
191 * @param board1 the newly updated board
192 * @param blastedCells1 the set of newly blasted cells
193 * @param speedChangeEvents the speed change events
194 * @return the next player list
195 */
196 private static List<Player> nextPlayers(
197 List<Player> players0,
198 Map<PlayerID, Bonus> playerBonuses,
199 Set<Cell> bombedCells1,
200 Board board1,
201 Set<Cell> blastedCells1,
202 Map<PlayerID, Optional<Direction>> speedChangeEvents) {
203 return null; // TODO
204 }
205
206 /**
207 * Computes and returns the next state of the given explosion list.
208 *
209 * @param explosions0 the previous explosion state
210 * @return the next explosion state
211 */
212 private static List<Sq<Sq<Cell>>> nextExplosions(List<Sq<Sq<Cell>>> explosions0) {
213 return null; // TODO
214 }
215
216 /**
217 * Computes and returns the list of newly dropped bombs by players according to the given player states and events.
218 *
219 * @param players0 the previous player states
220 * @param bombDropEvents the bomb drop events
221 * @param bombs0 the previous bomb state
222 * @return the next bomb states
223 */
224 private static List<Bomb> newlyDroppedBombs(
225 List<Player> players0,
226 Set<PlayerID> bombDropEvents,
227 List<Bomb> bombs0) {
228 return null; // TODO
229 }
230
146} 231}