Mid commit for problem solving
This commit is contained in:
@@ -303,7 +303,7 @@ public class ClientLauncherTUI {
|
||||
/**
|
||||
* Handles the {@code draw} command, dispatching to the appropriate controller draw method.
|
||||
*
|
||||
* @param parts the tokenised command: {@code [draw, upper|lower, tribe|building, pos]}.
|
||||
* @param parts the tokenized command: {@code [draw, upper|lower, tribe|building, pos]}.
|
||||
* @param controller the client controller to invoke.
|
||||
*/
|
||||
private void handleDraw(String[] parts, ClientController controller) {
|
||||
@@ -331,7 +331,7 @@ public class ClientLauncherTUI {
|
||||
/**
|
||||
* Parses an integer position argument at {@code idx} in {@code parts}.
|
||||
*
|
||||
* @param parts the tokenised command array.
|
||||
* @param parts the tokenized command array.
|
||||
* @param idx index of the position argument.
|
||||
* @return the parsed integer, or {@code -1} if missing or malformed.
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
* <p>The three top-level states that determine routing are:
|
||||
* <ul>
|
||||
* <li><b>Inactive</b> – no game model is present, or the game has ended.
|
||||
* Only disconnection clean-up is performed.</li>
|
||||
* Only disconnection cleanup is performed.</li>
|
||||
* <li><b>Suspended</b> – a forfeit timer is running because exactly one
|
||||
* player remains online. Only reconnection events are accepted.</li>
|
||||
* <li><b>Active</b> – normal gameplay; every event is applied, saved,
|
||||
@@ -120,7 +120,7 @@ public class GameEventProcessor {
|
||||
|
||||
/**
|
||||
* Handles events that arrive when no active game exists (not yet started,
|
||||
* or already ended). Only disconnection clean-up is relevant here.
|
||||
* or already ended). Only disconnection cleanup is relevant here.
|
||||
*
|
||||
* @param event the incoming event.
|
||||
*/
|
||||
@@ -255,7 +255,7 @@ public class GameEventProcessor {
|
||||
* Schedules the 60-second forfeit timer if a disconnection has left
|
||||
* exactly one player online.
|
||||
*
|
||||
* <p>If a previous timer is still pending it is cancelled first to avoid
|
||||
* <p>If a previous timer is still pending it is canceled first to avoid
|
||||
* duplicate timers.
|
||||
*
|
||||
* @param event the event that was just applied.
|
||||
|
||||
@@ -221,7 +221,7 @@ public class Board implements Serializable {
|
||||
* Take the selected card from the upper tribe list of the board.
|
||||
*
|
||||
* @param tribeCard is the card to remove.
|
||||
* @return true if the card is succesfully removed.
|
||||
* @return true if the card is successfully removed.
|
||||
*/
|
||||
public boolean removeUpperTribeCard(TribeCard tribeCard) {
|
||||
return upperListTribe.remove(tribeCard);
|
||||
|
||||
@@ -181,7 +181,7 @@ public class CurrentState implements Serializable {
|
||||
/**
|
||||
* Updates the current player, slot, and available draws.
|
||||
* If {@code slot} is {@code null}, both {@link #nUpper} and {@link #nLower} are reset to 0.
|
||||
* Otherwise they are set from the slot's values.
|
||||
* Otherwise, they are set from the slot's values.
|
||||
*
|
||||
* @param player the new current player.
|
||||
* @param slot the new current slot, or {@code null} when no slot is active.
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class OrderLogicCard implements Serializable {
|
||||
*
|
||||
* <p>The input list is shuffled in place to establish a random initial turn order.
|
||||
* This is intentional: the caller's list (typically {@code Game.playersList}) is
|
||||
* reordered so that the game's canonical player sequence reflects the randomised order.
|
||||
* reordered so that the game's canonical player sequence reflects the randomized order.
|
||||
*
|
||||
* @param players the list of players associated with this order logic card.
|
||||
* <strong>The list is mutated (shuffled) by this constructor.</strong>
|
||||
|
||||
@@ -11,7 +11,7 @@ public class InterfaceResolver {
|
||||
* Returns the local IPv4 address that can reach the given server IP.
|
||||
*
|
||||
* <p>If the server is localhost, returns {@code "127.0.0.1"}.
|
||||
* Otherwise iterates active non-loopback interfaces to find one on the same subnet;
|
||||
* Otherwise, iterates active non-loopback interfaces to find one on the same subnet;
|
||||
* falls back to a UDP connect trick if no matching subnet is found.
|
||||
*
|
||||
* @param serverIp the server IP address or hostname.
|
||||
|
||||
@@ -84,7 +84,7 @@ public class RMIClient implements IClient {
|
||||
* <p>Mirrors the {@code ScheduledExecutorService} in
|
||||
* {@code TCPClient.heartbeatLoop()} that writes {@code PING} every 3 s.
|
||||
* On {@link RemoteException} the server is considered gone and
|
||||
* {@link #disconnect()} is called — mirrors the behaviour on
|
||||
* {@link #disconnect()} is called — mirrors the behavior on
|
||||
* {@code SocketTimeoutException} / {@code IOException} in the TCP version.
|
||||
*/
|
||||
private void startHeartbeat() {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ServerLauncher {
|
||||
// ── Entry point ───────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Initialises all server components, wires them together, restores a saved
|
||||
* Initializes all server components, wires them together, restores a saved
|
||||
* game if available, and starts the event-processing loop and both network
|
||||
* servers.
|
||||
*
|
||||
@@ -145,7 +145,7 @@ public class ServerLauncher {
|
||||
*
|
||||
* <p>The save is discarded if all but at most one player was offline at the
|
||||
* time of the crash, since there would be nobody to resume the game with.
|
||||
* Otherwise the model is restored, the player-list limit is set, and each
|
||||
* Otherwise, the model is restored, the player-list limit is set, and each
|
||||
* player who was offline at crash time is pre-populated as offline so the
|
||||
* reconnection flow can handle them correctly.
|
||||
*
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Random;
|
||||
/**
|
||||
* Ambient fire-particle effect rendered on a transparent overlay pane.
|
||||
*
|
||||
* <p>Three particle types float from the screen corners toward the centre:
|
||||
* <p>Three particle types float from the screen corners toward the center:
|
||||
* <ul>
|
||||
* <li><b>embers</b> (type 0) — slow, glowing orange circles with a soft halo.</li>
|
||||
* <li><b>sparks</b> (type 1) — fast, short-lived bright particles.</li>
|
||||
@@ -40,7 +40,7 @@ public class FireParticleSystem {
|
||||
private final Scene scene;
|
||||
/** Currently live particles. */
|
||||
private final List<Particle> particles = new ArrayList<>();
|
||||
/** Shared random source for particle initialisation and physics noise. */
|
||||
/** Shared random source for particle initialization and physics noise. */
|
||||
private final Random rnd = new Random();
|
||||
/** Timestamp (ns) of the last particle spawn batch. */
|
||||
private long lastSpawn = 0;
|
||||
@@ -187,8 +187,8 @@ public class FireParticleSystem {
|
||||
final Circle glow;
|
||||
|
||||
/**
|
||||
* Initialises the particle at position ({@code x}, {@code y}) with velocity
|
||||
* aimed roughly from the given {@code corner} toward the scene centre.
|
||||
* Initializes the particle at position ({@code x}, {@code y}) with velocity
|
||||
* aimed roughly from the given {@code corner} toward the scene center.
|
||||
*
|
||||
* @param x spawn X coordinate.
|
||||
* @param y spawn Y coordinate.
|
||||
|
||||
@@ -73,7 +73,7 @@ public class GUI extends Application implements IView {
|
||||
|
||||
/**
|
||||
* JavaFX entry point: loads all FXML scenes, wires up controllers,
|
||||
* configures fullscreen behaviour, and shows the login scene.
|
||||
* configures fullscreen behavior, and shows the login scene.
|
||||
*
|
||||
* @param stage the primary stage provided by the JavaFX runtime.
|
||||
* @throws Exception if any FXML resource cannot be loaded.
|
||||
@@ -267,7 +267,7 @@ public class GUI extends Application implements IView {
|
||||
* Displays an error on the JavaFX application thread.
|
||||
*
|
||||
* <p>If the server crashed, returns to the login scene and re-enables the login button.
|
||||
* Otherwise delegates to the active scene's error display.
|
||||
* Otherwise, delegates to the active scene's error display.
|
||||
*
|
||||
* @param error the error type.
|
||||
* @param message a human-readable description of the error.
|
||||
|
||||
@@ -212,7 +212,7 @@ public class TotemFXMLController {
|
||||
"-fx-text-fill: " + (selected ? "#FFD700" : "#ffffff") + ";";
|
||||
}
|
||||
|
||||
/** Returns the totem name with only the first letter capitalised. */
|
||||
/** Returns the totem name with only the first letter capitalized. */
|
||||
private String capitalize(Totems t) {
|
||||
String s = t.name().toLowerCase(Locale.ROOT);
|
||||
return Character.toUpperCase(s.charAt(0)) + s.substring(1);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AsciiTable {
|
||||
return sb.toString();
|
||||
}
|
||||
/**
|
||||
* Builds a single horizontal border line across all columns.
|
||||
* Builds a single horizontal borderline across all columns.
|
||||
*
|
||||
* @param l left-end character.
|
||||
* @param m middle junction character (between columns).
|
||||
@@ -105,6 +105,7 @@ public class AsciiTable {
|
||||
* @param maxWidth width in display columns of each cell (including padding).
|
||||
* @return the rendered horizontal line string.
|
||||
*/
|
||||
@SuppressWarnings("GrazieInspection")
|
||||
private String hline(String l, String m, String r, int maxWidth) {
|
||||
var sb = new StringBuilder(l);
|
||||
for (int i = 0; i < cols; i++) {
|
||||
|
||||
@@ -86,7 +86,7 @@ class HuntTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("p2 doesnt have building 7")
|
||||
@DisplayName("p2 doesn't have building 7")
|
||||
void activateEvent4() {
|
||||
Player p1 = new Player("Giacomo");
|
||||
Player p2 = new Player("xiaomi");
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class SustenanceTest {
|
||||
void testConstructor() {
|
||||
int era = 1;
|
||||
int prestigeDebt = 5;
|
||||
// Gli attributi di Sustenance era e EventType vengono testati in EventCardTest.
|
||||
// Gli attributi di Sustenance era ed EventType vengono testati in EventCardTest.
|
||||
|
||||
Sustenance s = new Sustenance(era, prestigeDebt);
|
||||
assertEquals(prestigeDebt, s.getPrestigeDebt());
|
||||
|
||||
Reference in New Issue
Block a user