Skip to content

Commit

Permalink
Coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Max committed Apr 1, 2024
1 parent fbe4f6d commit 9c27ec2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/ch/epfl/chacun/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,6 @@ public enum Action {
* Points must be counted and the winner(s) announced, as the last player has completed
* his turn(s) and the pile of normal tiles is empty.
*/
END_GAME;
END_GAME
}
}
8 changes: 7 additions & 1 deletion src/ch/epfl/chacun/Rotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public enum Rotation {
*/
public static final int COUNT = ALL.size();


/**
* The number of degrees per quarter turn.
*/
private static final int DEGREES_PER_QUARTER_TURN = 90;

/**
* Calculates the addition of two rotations.
*
Expand Down Expand Up @@ -59,7 +65,7 @@ public int quarterTurnsCW() {
* @return the number of degrees clockwise of the rotation
*/
public int degreesCW() {
return this.quarterTurnsCW() * 90;
return this.quarterTurnsCW() * DEGREES_PER_QUARTER_TURN;
}

}
2 changes: 1 addition & 1 deletion src/ch/epfl/chacun/Tile.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ public Set<Zone> zones() {
public enum Kind {
START,
NORMAL,
MENHIR;
MENHIR
}
}
4 changes: 2 additions & 2 deletions src/ch/epfl/chacun/Zone.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed interface Zone {
static int tileId(int zoneId) {
// Since a zoneId is obtained using zoneId = 10 * tileId + localId and localId is between 0 and 9
// We can use integer division to obtain the tileId
return (int) (zoneId / 10);
return zoneId / 10;
}

/**
Expand Down Expand Up @@ -71,7 +71,7 @@ default SpecialPower specialPower() {
* Represents the different special powers.
*/
enum SpecialPower {
SHAMAN, LOGBOAT, HUNTING_TRAP, PIT_TRAP, WILD_FIRE, RAFT;
SHAMAN, LOGBOAT, HUNTING_TRAP, PIT_TRAP, WILD_FIRE, RAFT
}

/**
Expand Down
10 changes: 4 additions & 6 deletions src/ch/epfl/chacun/ZonePartitions.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,10 @@ public void addTile(Tile tile) {
*/
public void connectSides(TileSide s1, TileSide s2) {
switch (s1) {
case TileSide.Meadow(Zone.Meadow m1) when s2 instanceof TileSide.Meadow(Zone.Meadow m2) -> {
meadows.union(m1, m2);
}
case TileSide.Forest(Zone.Forest f1) when s2 instanceof TileSide.Forest(Zone.Forest f2) -> {
forests.union(f1, f2);
}
case TileSide.Meadow(Zone.Meadow m1) when s2 instanceof TileSide.Meadow(Zone.Meadow m2) ->
meadows.union(m1, m2);
case TileSide.Forest(Zone.Forest f1) when s2 instanceof TileSide.Forest(Zone.Forest f2) ->
forests.union(f1, f2);
case TileSide.River(
Zone.Meadow m3, Zone.River r1, Zone.Meadow m4
) when s2 instanceof TileSide.River(Zone.Meadow m5, Zone.River r2, Zone.Meadow m6) -> {
Expand Down

0 comments on commit 9c27ec2

Please sign in to comment.