aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl')
-rw-r--r--src/ch/epfl/xblast/server/Board.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java
index 5e899f6..2cbf380 100644
--- a/src/ch/epfl/xblast/server/Board.java
+++ b/src/ch/epfl/xblast/server/Board.java
@@ -2,6 +2,7 @@ package ch.epfl.xblast.server;
2 2
3import ch.epfl.cs108.Sq; 3import ch.epfl.cs108.Sq;
4import ch.epfl.xblast.Lists; 4import ch.epfl.xblast.Lists;
5import ch.epfl.xblast.Cell;
5 6
6import java.util.ArrayList; 7import java.util.ArrayList;
7import java.util.List; 8import java.util.List;
@@ -123,4 +124,23 @@ public final class Board {
123 return ofInnerBlocksWalled(rowsList); 124 return ofInnerBlocksWalled(rowsList);
124 } 125 }
125 126
127 /**
128 * Return the sequence of blocks related to the given cell.
129 *
130 * @param c cell
131 * @return the sequence of blocks related to the given cell.
132 */
133 public Sq<Block> blocksAt(Cell c) {
134 return blocks.get(c.rowMajorIndex());
135 }
136
137 /**
138 * Returns the block related to the given cell.
139 *
140 * @param c cell
141 * @return the first block of the sequence related to the given cell
142 */
143 public Block blockAt(Cell c) {
144 return blocksAt(c).head();
145 }
126} 146}