diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ch/epfl/xblast/ArgumentChecker.java | 2 | ||||
-rw-r--r-- | src/ch/epfl/xblast/Cell.java | 3 | ||||
-rw-r--r-- | src/ch/epfl/xblast/Direction.java | 2 | ||||
-rw-r--r-- | src/ch/epfl/xblast/Lists.java | 4 | ||||
-rw-r--r-- | src/ch/epfl/xblast/SubCell.java | 3 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Block.java | 8 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Board.java | 14 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Bomb.java | 27 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/GameState.java | 14 | ||||
-rw-r--r-- | src/ch/epfl/xblast/server/Player.java | 45 |
10 files changed, 105 insertions, 17 deletions
diff --git a/src/ch/epfl/xblast/ArgumentChecker.java b/src/ch/epfl/xblast/ArgumentChecker.java index a8ca31a..8ba744e 100644 --- a/src/ch/epfl/xblast/ArgumentChecker.java +++ b/src/ch/epfl/xblast/ArgumentChecker.java | |||
@@ -42,7 +42,7 @@ public final class ArgumentChecker { | |||
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Requires the given sequence to be non-empty and returns it or throw an IllegalArgumentException otherwise. | 45 | * Requires the given Sequence to be non-empty and returns it or throw an IllegalArgumentException otherwise. |
46 | * | 46 | * |
47 | * @param s the sequence to check | 47 | * @param s the sequence to check |
48 | * @param <T> the sequence type | 48 | * @param <T> the sequence type |
diff --git a/src/ch/epfl/xblast/Cell.java b/src/ch/epfl/xblast/Cell.java index 16632cc..8214066 100644 --- a/src/ch/epfl/xblast/Cell.java +++ b/src/ch/epfl/xblast/Cell.java | |||
@@ -28,7 +28,7 @@ public final class Cell { | |||
28 | public static final int COUNT = COLUMNS * ROWS; | 28 | public static final int COUNT = COLUMNS * ROWS; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The list of the board's Cell's, major-ordered. | 31 | * The list of the board's Cell-s, major-ordered. |
32 | */ | 32 | */ |
33 | public static final List<Cell> ROW_MAJOR_ORDER = Collections.unmodifiableList(rowMajorOrder()); | 33 | public static final List<Cell> ROW_MAJOR_ORDER = Collections.unmodifiableList(rowMajorOrder()); |
34 | 34 | ||
@@ -36,6 +36,7 @@ public final class Cell { | |||
36 | * The list of the board's Cell-s, spiral-ordered. | 36 | * The list of the board's Cell-s, spiral-ordered. |
37 | */ | 37 | */ |
38 | public static final List<Cell> SPIRAL_ORDER = Collections.unmodifiableList(spiralOrder()); | 38 | public static final List<Cell> SPIRAL_ORDER = Collections.unmodifiableList(spiralOrder()); |
39 | |||
39 | /** | 40 | /** |
40 | * The coordinates of the Cell. | 41 | * The coordinates of the Cell. |
41 | */ | 42 | */ |
diff --git a/src/ch/epfl/xblast/Direction.java b/src/ch/epfl/xblast/Direction.java index 5f5df33..b8852de 100644 --- a/src/ch/epfl/xblast/Direction.java +++ b/src/ch/epfl/xblast/Direction.java | |||
@@ -1,7 +1,7 @@ | |||
1 | package ch.epfl.xblast; | 1 | package ch.epfl.xblast; |
2 | 2 | ||
3 | /** | 3 | /** |
4 | * A Direction. | 4 | * Directions. |
5 | * | 5 | * |
6 | * @author Pacien TRAN-GIRARD (261948) | 6 | * @author Pacien TRAN-GIRARD (261948) |
7 | * @author Timothée FLOURE (257420) | 7 | * @author Timothée FLOURE (257420) |
diff --git a/src/ch/epfl/xblast/Lists.java b/src/ch/epfl/xblast/Lists.java index d599776..22d9d06 100644 --- a/src/ch/epfl/xblast/Lists.java +++ b/src/ch/epfl/xblast/Lists.java | |||
@@ -34,7 +34,7 @@ public final class Lists { | |||
34 | * | 34 | * |
35 | * @param l the list to reverse | 35 | * @param l the list to reverse |
36 | * @param <T> the type of the list's elements | 36 | * @param <T> the type of the list's elements |
37 | * @return a reversed copy of the list. | 37 | * @return a reversed copy of the list |
38 | */ | 38 | */ |
39 | private static <T> List<T> reversed(List<T> l) { | 39 | private static <T> List<T> reversed(List<T> l) { |
40 | List<T> r = new ArrayList<>(l); | 40 | List<T> r = new ArrayList<>(l); |
@@ -70,7 +70,7 @@ public final class Lists { | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Returns all the permutations of the elements of the given list | 73 | * Returns all the permutations of the elements of the given list. |
74 | * | 74 | * |
75 | * @param l given list | 75 | * @param l given list |
76 | * @param <T> the type of the list's elements | 76 | * @param <T> the type of the list's elements |
diff --git a/src/ch/epfl/xblast/SubCell.java b/src/ch/epfl/xblast/SubCell.java index 9585fd2..51cbbb4 100644 --- a/src/ch/epfl/xblast/SubCell.java +++ b/src/ch/epfl/xblast/SubCell.java | |||
@@ -27,6 +27,7 @@ public final class SubCell { | |||
27 | * The height of the board (total of sub-rows). | 27 | * The height of the board (total of sub-rows). |
28 | */ | 28 | */ |
29 | private static final int SUB_ROWS = SUB_ROW_DIVISIONS * Cell.ROWS; | 29 | private static final int SUB_ROWS = SUB_ROW_DIVISIONS * Cell.ROWS; |
30 | |||
30 | /** | 31 | /** |
31 | * The coordinates of the SubCell. | 32 | * The coordinates of the SubCell. |
32 | */ | 33 | */ |
@@ -148,7 +149,7 @@ public final class SubCell { | |||
148 | /** | 149 | /** |
149 | * Returns a String representation of the coordinates of the SubCell. | 150 | * Returns a String representation of the coordinates of the SubCell. |
150 | * | 151 | * |
151 | * @return a String representation of the coordinates of the SubCell. | 152 | * @return a String representation of the coordinates of the SubCell |
152 | */ | 153 | */ |
153 | @Override | 154 | @Override |
154 | public String toString() { | 155 | public String toString() { |
diff --git a/src/ch/epfl/xblast/server/Block.java b/src/ch/epfl/xblast/server/Block.java index 1bfe891..5ada099 100644 --- a/src/ch/epfl/xblast/server/Block.java +++ b/src/ch/epfl/xblast/server/Block.java | |||
@@ -3,7 +3,7 @@ package ch.epfl.xblast.server; | |||
3 | import java.util.NoSuchElementException; | 3 | import java.util.NoSuchElementException; |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * A Block. | 6 | * Blocks. |
7 | * | 7 | * |
8 | * @author Pacien TRAN-GIRARD (261948) | 8 | * @author Pacien TRAN-GIRARD (261948) |
9 | * @author Timothée FLOURE (257420) | 9 | * @author Timothée FLOURE (257420) |
@@ -41,19 +41,19 @@ public enum Block { | |||
41 | BONUS_RANGE(Bonus.INC_RANGE); | 41 | BONUS_RANGE(Bonus.INC_RANGE); |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Corresponding bonus, or null | 44 | * Corresponding bonus, or null. |
45 | */ | 45 | */ |
46 | private Bonus maybeAssociatedBonus; | 46 | private Bonus maybeAssociatedBonus; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Main builder, used by the bonus blocks | 49 | * Main builder, used by the bonus blocks. |
50 | */ | 50 | */ |
51 | Block(Bonus maybeAssociatedBonus) { | 51 | Block(Bonus maybeAssociatedBonus) { |
52 | this.maybeAssociatedBonus = maybeAssociatedBonus; | 52 | this.maybeAssociatedBonus = maybeAssociatedBonus; |
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Default builder, used by the non-bonus blocks | 56 | * Default builder, used by the non-bonus blocks. |
57 | */ | 57 | */ |
58 | Block() { | 58 | Block() { |
59 | this.maybeAssociatedBonus = null; | 59 | this.maybeAssociatedBonus = null; |
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java index 06f3081..a18422a 100644 --- a/src/ch/epfl/xblast/server/Board.java +++ b/src/ch/epfl/xblast/server/Board.java | |||
@@ -23,13 +23,21 @@ public final class Board { | |||
23 | */ | 23 | */ |
24 | static final int BOMB_BLOCKING_DISTANCE = 6; | 24 | static final int BOMB_BLOCKING_DISTANCE = 6; |
25 | 25 | ||
26 | private static final int BLOCKS_LIST_SIZE = 195; | 26 | /** |
27 | * Dimensions of the Board. | ||
28 | */ | ||
27 | private static final int BOARD_ROWS = 13; | 29 | private static final int BOARD_ROWS = 13; |
28 | private static final int BOARD_COLUMNS = 15; | 30 | private static final int BOARD_COLUMNS = 15; |
29 | private static final int INNER_BOARD_ROWS = BOARD_ROWS - 2; | 31 | private static final int INNER_BOARD_ROWS = BOARD_ROWS - 2; |
30 | private static final int INNER_BOARD_COLUMNS = BOARD_COLUMNS - 2; | 32 | private static final int INNER_BOARD_COLUMNS = BOARD_COLUMNS - 2; |
31 | private static final int QUADRANT_ROWS = 6; | 33 | private static final int QUADRANT_ROWS = 6; |
32 | private static final int QUADRANT_COLUMNS = 7; | 34 | private static final int QUADRANT_COLUMNS = 7; |
35 | |||
36 | /** | ||
37 | * Number of blocks of a Board. | ||
38 | */ | ||
39 | private static final int BLOCKS_LIST_SIZE = BOARD_ROWS * BOARD_COLUMNS; | ||
40 | |||
33 | /** | 41 | /** |
34 | * List containing all the blocks of the board. | 42 | * List containing all the blocks of the board. |
35 | */ | 43 | */ |
@@ -83,7 +91,7 @@ public final class Board { | |||
83 | } | 91 | } |
84 | 92 | ||
85 | /** | 93 | /** |
86 | * Build a walled board filled with the given inner rows | 94 | * Build a walled board filled with the given inner rows. |
87 | * | 95 | * |
88 | * @param innerBlocks lists of the internal rows | 96 | * @param innerBlocks lists of the internal rows |
89 | * @return a new walled board filled with the given rows | 97 | * @return a new walled board filled with the given rows |
@@ -134,7 +142,7 @@ public final class Board { | |||
134 | * Return the sequence of blocks related to the given cell. | 142 | * Return the sequence of blocks related to the given cell. |
135 | * | 143 | * |
136 | * @param c cell | 144 | * @param c cell |
137 | * @return the sequence of blocks related to the given cell. | 145 | * @return the sequence of blocks related to the given cell |
138 | */ | 146 | */ |
139 | public Sq<Block> blocksAt(Cell c) { | 147 | public Sq<Block> blocksAt(Cell c) { |
140 | return this.blocks.get(c.rowMajorIndex()); | 148 | return this.blocks.get(c.rowMajorIndex()); |
diff --git a/src/ch/epfl/xblast/server/Bomb.java b/src/ch/epfl/xblast/server/Bomb.java index 78de111..535573f 100644 --- a/src/ch/epfl/xblast/server/Bomb.java +++ b/src/ch/epfl/xblast/server/Bomb.java | |||
@@ -20,11 +20,31 @@ import java.util.stream.Stream; | |||
20 | */ | 20 | */ |
21 | public final class Bomb { | 21 | public final class Bomb { |
22 | 22 | ||
23 | /** | ||
24 | * Function consuming a step of the Bomb's fuse. | ||
25 | */ | ||
23 | private static final UnaryOperator<Integer> FUSE_STEP_FUNCTION = fl -> fl - 1; | 26 | private static final UnaryOperator<Integer> FUSE_STEP_FUNCTION = fl -> fl - 1; |
27 | |||
28 | /** | ||
29 | * Owner of the Bomb. | ||
30 | */ | ||
24 | private PlayerID ownerId; | 31 | private PlayerID ownerId; |
32 | |||
33 | /** | ||
34 | * Position of the Bomb. | ||
35 | */ | ||
25 | private Cell position; | 36 | private Cell position; |
37 | |||
38 | /** | ||
39 | * Fuse of the Bomb. | ||
40 | */ | ||
26 |