Skip to content

Commit

Permalink
Format code.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaglam committed Apr 17, 2023
1 parent c0676f2 commit de8a3cb
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/main/java/carcassonne/control/ControllerFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import carcassonne.view.GlobalKeyBindingManager;

/**
* Facade for the game controller. Allows to call view classes or potentially external services to make requests regarding
* the game flow.
* Facade for the game controller. Allows to call view classes or potentially external services to make requests
* regarding the game flow.
* @author Timur Saglam
*/
public interface ControllerFacade {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/carcassonne/model/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public boolean hasEmptyHand() {
* Returns a meeple after its job is down. Allows the player to place another meeple.
*/
public void returnMeeple(Meeple meeple) {
boolean isRemoved = placedMeeples.remove(meeple);
boolean isRemoved = placedMeeples.remove(meeple);
assert isRemoved;
freeMeeples++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/carcassonne/model/Round.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Round {

private static final String NOTHING = "";
private static final String SQUARE_BRACKETS = "[\\[\\]]";

private int activePlayerIndex;
private final Grid grid;
private Player[] players;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/carcassonne/model/ai/RuleBasedComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public int compare(AbstractCarcassonneMove firstMove, AbstractCarcassonneMove se
private int compareMoveType(AbstractCarcassonneMove move) {
if (move.involvesMeeplePlacement()) {
switch (move.getMeepleType()) {
case CASTLE:
return 3;
case MONASTERY:
return 2;
case ROAD:
return 1;
default:
case CASTLE:
return 3;
case MONASTERY:
return 2;
case ROAD:
return 1;
default:
}
}
return 0; // fields or no meeple placed
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/carcassonne/model/grid/GridDirection.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public GridDirection nextDirectionTo(RotationDirection side) {
if (this == CENTER) {
return this;
}
GridDirection[] cycle = { NORTH, NORTH_EAST, EAST, SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST };
GridDirection[] cycle = {NORTH, NORTH_EAST, EAST, SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST};
int position = -2; // error case, sum with parameter side is negative
for (int i = 0; i < cycle.length; i++) {
if (cycle[i] == this) { // find in cycle
Expand Down Expand Up @@ -167,6 +167,6 @@ public static List<GridDirection> byRow() {
* @return a 2D list of of NORTH_WEST, WEST, SOUTH_WEST, NORTH, CENTER, SOUTH, NORTH_EAST, EAST and SOUTH_EAST.
*/
public static GridDirection[][] values2D() {
return new GridDirection[][] { { NORTH_WEST, WEST, SOUTH_WEST }, { NORTH, CENTER, SOUTH }, { NORTH_EAST, EAST, SOUTH_EAST } };
return new GridDirection[][] {{NORTH_WEST, WEST, SOUTH_WEST}, {NORTH, CENTER, SOUTH}, {NORTH_EAST, EAST, SOUTH_EAST}};
}
}
6 changes: 3 additions & 3 deletions src/main/java/carcassonne/settings/GameSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public class GameSettings {
private static final String MEEPLE_PATH = "meeple/meeple_";
private static final String PNG = ".png";
private static final String TEMPLATE = "_template";
private static final String[] DEFAULT_NAMES = { "ONE", "TWO", "THREE", "FOUR", "FIVE" };
private static final String[] DEFAULT_NAMES = {"ONE", "TWO", "THREE", "FOUR", "FIVE"};

// COLOR CONSTANTS:
public static final Color UI_COLOR = new Color(190, 190, 190);
private static final PlayerColor[] DEFAULT_COLORS = { new PlayerColor(30, 26, 197), new PlayerColor(151, 4, 12), new PlayerColor(14, 119, 25),
new PlayerColor(216, 124, 0), new PlayerColor(96, 0, 147) };
private static final PlayerColor[] DEFAULT_COLORS = {new PlayerColor(30, 26, 197), new PlayerColor(151, 4, 12), new PlayerColor(14, 119, 25),
new PlayerColor(216, 124, 0), new PlayerColor(96, 0, 147)};

// COSMETIC:
private final List<PlayerColor> colors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class GameStatisticsModel extends AbstractTableModel {

private static final long serialVersionUID = -7138458001360243937L; // generated UID
private final Round round;
private static final String[] HEADER = { "Player", "Castle", "Road", "Monastery", "Field", "SCORE" };
private static final String[] HEADER = {"Player", "Castle", "Road", "Monastery", "Field", "SCORE"};

/**
* Creates the game statistics model with the current round.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.ToolTipManager;

import carcassonne.model.terrain.TerrainType;
import carcassonne.model.tile.TileDistribution;
Expand Down Expand Up @@ -195,7 +194,7 @@ private JPanel createFortificationPanel() {
panel.add(checkBox);
return panel;
}

private JPanel createEnclavePanel() {
JPanel panel = createBasicPanel(ENCLAVE);
panel.setToolTipText(ENCLAVE_TOOL_TIP);
Expand Down

0 comments on commit de8a3cb

Please sign in to comment.