aboutsummaryrefslogtreecommitdiff
path: root/src/ch
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-02-29 15:34:45 +0100
committerPacien TRAN-GIRARD2016-02-29 15:34:45 +0100
commitf28560be9aceaf407613834a8fade1bfeedda449 (patch)
treedadd4d5dd3f89668d6a7153bf3de8d069ea0417e /src/ch
parent1c2350a9f65068cc2e41ff1d471e5a73c55751f0 (diff)
downloadxblast-f28560be9aceaf407613834a8fade1bfeedda449.tar.gz
Reformat code
Diffstat (limited to 'src/ch')
-rw-r--r--src/ch/epfl/xblast/Lists.java8
-rw-r--r--src/ch/epfl/xblast/server/Block.java1
-rw-r--r--src/ch/epfl/xblast/server/Board.java26
-rw-r--r--src/ch/epfl/xblast/server/Ticks.java2
4 files changed, 22 insertions, 15 deletions
diff --git a/src/ch/epfl/xblast/Lists.java b/src/ch/epfl/xblast/Lists.java
index 096ceba..aadc694 100644
--- a/src/ch/epfl/xblast/Lists.java
+++ b/src/ch/epfl/xblast/Lists.java
@@ -1,20 +1,21 @@
1package ch.epfl.xblast; 1package ch.epfl.xblast;
2 2
3import java.util.List;
4import java.util.ArrayList; 3import java.util.ArrayList;
5import java.util.Collections; 4import java.util.Collections;
5import java.util.List;
6 6
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)
10 */ 10 */
11public final class Lists { 11public final class Lists {
12
12 /** 13 /**
13 * Return a sysmetric version of the list. 14 * Return a sysmetric version of the list.
14 * 15 *
15 * @param l the input list 16 * @param l the input list
16 * @throws IllegalArgumentException if the given list is empty
17 * @return mirroredList the mirrored ilist 17 * @return mirroredList the mirrored ilist
18 * @throws IllegalArgumentException if the given list is empty
18 */ 19 */
19 public static <T> List<T> mirrored(List<T> l) { 20 public static <T> List<T> mirrored(List<T> l) {
20 if (l.size() == 0) { 21 if (l.size() == 0) {
@@ -24,7 +25,7 @@ public final class Lists {
24 List<T> mirroredList = new ArrayList<T>(); 25 List<T> mirroredList = new ArrayList<T>();
25 List<T> rightSide = new ArrayList<T>(); 26 List<T> rightSide = new ArrayList<T>();
26 27
27 for (int i=0;i < l.size()-1;i++) { 28 for (int i = 0; i < l.size() - 1; i++) {
28 rightSide.add(l.get(i)); 29 rightSide.add(l.get(i));
29 } 30 }
30 31
@@ -35,4 +36,5 @@ public final class Lists {
35 36
36 return mirroredList; 37 return mirroredList;
37 } 38 }
39
38} 40}
diff --git a/src/ch/epfl/xblast/server/Block.java b/src/ch/epfl/xblast/server/Block.java
index d1c96e5..409f68e 100644
--- a/src/ch/epfl/xblast/server/Block.java
+++ b/src/ch/epfl/xblast/server/Block.java
@@ -54,4 +54,5 @@ public enum Block {
54 public boolean castsShadow() { 54 public boolean castsShadow() {
55 return this == INDESTRUCTIBLE_WALL || this == DESTRUCTIBLE_WALL || this == CRUMBLING_WALL; 55 return this == INDESTRUCTIBLE_WALL || this == DESTRUCTIBLE_WALL || this == CRUMBLING_WALL;
56 } 56 }
57
57} 58}
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java
index b385ed8..62cfd0a 100644
--- a/src/ch/epfl/xblast/server/Board.java
+++ b/src/ch/epfl/xblast/server/Board.java
@@ -1,18 +1,19 @@
1package ch.epfl.xblast.server; 1package ch.epfl.xblast.server;
2 2
3import java.util.List;
4import java.util.ArrayList;
5import ch.epfl.cs108.Sq; 3import ch.epfl.cs108.Sq;
6import ch.epfl.xblast.Lists; 4import ch.epfl.xblast.Lists;
7 5
6import java.util.ArrayList;
7import java.util.List;
8
8/** 9/**
9 * A two-dimensional Board in which the game takes place. 10 * A two-dimensional Board in which the game takes place.
10 * 11 *
11 * @author Pacien TRAN-GIRARD (261948) 12 * @author Pacien TRAN-GIRARD (261948)
12 * @author Timothée FLOURE (257420) 13 * @author Timothée FLOURE (257420)
13 */ 14 */
14
15public final class Board { 15public final class Board {
16
16 /** 17 /**
17 * List containing all the blocks of the board. 18 * List containing all the blocks of the board.
18 */ 19 */
@@ -21,10 +22,10 @@ public final class Board {
21 /** 22 /**
22 * Instanciates a new Board with the given sequence of blocks. 23 * Instanciates a new Board with the given sequence of blocks.
23 * 24 *
24 * @throws IllegalArgumentException if the blocks is not composed of 195 elements
25 * @param blocks sequence containing all the blocks of the Boards 25 * @param blocks sequence containing all the blocks of the Boards
26 * @throws IllegalArgumentException if the blocks is not composed of 195 elements
26 */ 27 */
27 public Board (List<Sq<Block>> blocks) { 28 public Board(List<Sq<Block>> blocks) {
28 if (blocks.size() != 195) { 29 if (blocks.size() != 195) {
29 throw new IllegalArgumentException(); 30 throw new IllegalArgumentException();
30 } 31 }
@@ -35,8 +36,8 @@ public final class Board {
35 * Build a new Board with the given Matrix. 36 * Build a new Board with the given Matrix.
36 * 37 *
37 * @param rows list containing all the rows 38 * @param rows list containing all the rows
38 * @throws IllegalArgumentException if rows is not 13*15
39 * @return a new Board built with given rows 39 * @return a new Board built with given rows
40 * @throws IllegalArgumentException if rows is not 13*15
40 */ 41 */
41 public static Board ofRows(List<List<Block>> rows) { 42 public static Board ofRows(List<List<Block>> rows) {
42 if (rows.size() != 13) { 43 if (rows.size() != 13) {
@@ -60,11 +61,11 @@ public final class Board {
60 } 61 }
61 62
62 /** 63 /**
63 * Build a walled board filled with the given inner rows 64 * Build a walled board filled with the given inner rows
64 * 65 *
65 * @param innerBlocks lists of the internal rows 66 * @param innerBlocks lists of the internal rows
66 * @throws IllegalArgumentException if innerbLocks is not 11*13
67 * @return a new walled board filled with the given rows 67 * @return a new walled board filled with the given rows
68 * @throws IllegalArgumentException if innerbLocks is not 11*13
68 */ 69 */
69 public static Board ofInnerBlocksWalled(List<List<Block>> innerBlocks) { 70 public static Board ofInnerBlocksWalled(List<List<Block>> innerBlocks) {
70 if (innerBlocks.size() != 11) { 71 if (innerBlocks.size() != 11) {
@@ -74,7 +75,7 @@ public final class Board {
74 List<List<Block>> rowsList = new ArrayList<>(); 75 List<List<Block>> rowsList = new ArrayList<>();
75 List<Block> wallLine = new ArrayList<>(); 76 List<Block> wallLine = new ArrayList<>();
76 77
77 for (int i = 0; i < 15;i++) { 78 for (int i = 0; i < 15; i++) {
78 wallLine.add(Block.INDESTRUCTIBLE_WALL); 79 wallLine.add(Block.INDESTRUCTIBLE_WALL);
79 } 80 }
80 81
@@ -84,13 +85,13 @@ public final class Board {
84 } 85 }
85 86
86 List<Block> row = innerBlocks.get(i); 87 List<Block> row = innerBlocks.get(i);
87 row.add(0,Block.INDESTRUCTIBLE_WALL); 88 row.add(0, Block.INDESTRUCTIBLE_WALL);
88 row.add(Block.INDESTRUCTIBLE_WALL); 89 row.add(Block.INDESTRUCTIBLE_WALL);
89 90
90 rowsList.add(row); 91 rowsList.add(row);
91 } 92 }
92 93
93 rowsList.add(0,wallLine); 94 rowsList.add(0, wallLine);
94 rowsList.add(wallLine); 95 rowsList.add(wallLine);
95 96
96 return ofRows(rowsList); 97 return ofRows(rowsList);
@@ -100,8 +101,8 @@ public final class Board {
100 * Build a symmetric walled board from the NWB quadrant. 101 * Build a symmetric walled board from the NWB quadrant.
101 * 102 *
102 * @param quadrantNWBlocks the NW quadrant of the board (inner blocks only!) 103 * @param quadrantNWBlocks the NW quadrant of the board (inner blocks only!)
103 * @throws IllegalArgumentException if quadrantNWBlocks is not 6*7
104 * @return a new walled board symmetrically filled with the given NW quadrant 104 * @return a new walled board symmetrically filled with the given NW quadrant
105 * @throws IllegalArgumentException if quadrantNWBlocks is not 6*7
105 */ 106 */
106 public static Board ofQuadrantNWBlocksWalled(List<List<Block>> quadrantNWBlocks) { 107 public static Board ofQuadrantNWBlocksWalled(List<List<Block>> quadrantNWBlocks) {
107 if (quadrantNWBlocks.size() != 6) { 108 if (quadrantNWBlocks.size() != 6) {
@@ -121,4 +122,5 @@ public final class Board {
121 } 122 }
122 return ofInnerBlocksWalled(rowsList); 123 return ofInnerBlocksWalled(rowsList);
123 } 124 }
125
124} 126}
diff --git a/src/ch/epfl/xblast/server/Ticks.java b/src/ch/epfl/xblast/server/Ticks.java
index 0992876..cdccad8 100644
--- a/src/ch/epfl/xblast/server/Ticks.java
+++ b/src/ch/epfl/xblast/server/Ticks.java
@@ -7,6 +7,7 @@ package ch.epfl.xblast.server;
7 * @author Timothée FLOURE (257420) 7 * @author Timothée FLOURE (257420)
8 */ 8 */
9public interface Ticks { 9public interface Ticks {
10
10 /** 11 /**
11 * Duration of the death of a player (in ticks). 12 * Duration of the death of a player (in ticks).
12 */ 13 */
@@ -36,4 +37,5 @@ public interface Ticks {
36 * Duration of the presence of a bonus (in ticks). 37 * Duration of the presence of a bonus (in ticks).
37 */ 38 */
38 public static int BONUS_DISAPPEARING_TICKS = EXPLOSION_TICKS; 39 public static int BONUS_DISAPPEARING_TICKS = EXPLOSION_TICKS;
40
39} 41}