aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-03-15 20:13:21 +0100
committerPacien TRAN-GIRARD2016-03-15 20:13:21 +0100
commit3c47558d60a05f3f46674da610a7a550a559b4be (patch)
treecf944252419c3b3f27d52a6f3338ff9acfbc543a /src/ch/epfl
parentfab4253bba72b035fe36124d66d10799b224b6cf (diff)
downloadxblast-3c47558d60a05f3f46674da610a7a550a559b4be.tar.gz
Implement bombedCells() and blastedCells() mapping functions
Diffstat (limited to 'src/ch/epfl')
-rw-r--r--src/ch/epfl/xblast/server/GameState.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index 2c6f372..cbe29b5 100644
--- a/src/ch/epfl/xblast/server/GameState.java
+++ b/src/ch/epfl/xblast/server/GameState.java
@@ -7,6 +7,7 @@ import ch.epfl.xblast.Direction;
7import ch.epfl.xblast.PlayerID; 7import ch.epfl.xblast.PlayerID;
8 8
9import java.util.*; 9import java.util.*;
10import java.util.function.Function;
10import java.util.stream.Collectors; 11import java.util.stream.Collectors;
11import java.util.stream.Stream; 12import java.util.stream.Stream;
12 13
@@ -205,7 +206,9 @@ public final class GameState {
205 * @return the map of bombs 206 * @return the map of bombs
206 */ 207 */
207 public Map<Cell, Bomb> bombedCells() { 208 public Map<Cell, Bomb> bombedCells() {
208 return null; // TODO 209 return this.bombs
210 .stream()
211 .collect(Collectors.toMap(Bomb::position, Function.identity()));
209 } 212 }
210 213
211 /** 214 /**
@@ -214,7 +217,10 @@ public final class GameState {
214 * @return the set of blasted cells 217 * @return the set of blasted cells
215 */ 218 */
216 public Set<Cell> blastedCells() { 219 public Set<Cell> blastedCells() {
217 return null; // TODO 220 return this.blasts
221 .stream()
222 .map(Sq::head)
223 .collect(Collectors.toSet());
218 } 224 }
219 225
220 /** 226 /**