From 3c47558d60a05f3f46674da610a7a550a559b4be Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 15 Mar 2016 20:13:21 +0100 Subject: Implement bombedCells() and blastedCells() mapping functions --- src/ch/epfl/xblast/server/GameState.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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; import ch.epfl.xblast.PlayerID; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -205,7 +206,9 @@ public final class GameState { * @return the map of bombs */ public Map bombedCells() { - return null; // TODO + return this.bombs + .stream() + .collect(Collectors.toMap(Bomb::position, Function.identity())); } /** @@ -214,7 +217,10 @@ public final class GameState { * @return the set of blasted cells */ public Set blastedCells() { - return null; // TODO + return this.blasts + .stream() + .map(Sq::head) + .collect(Collectors.toSet()); } /** -- cgit v1.2.3