Skip to content

Commit

Permalink
Tell player largest dimension on error
Browse files Browse the repository at this point in the history
  • Loading branch information
lscgh committed Feb 9, 2024
1 parent 6b49618 commit 573f51c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class GameConfig {
static String ERROR_OPPONENT_PLAYER_NULL = "Couldn't add the opponent player to the game.";
static String ERROR_PLAYER_ALREADY_IN_GAME = "You are currently playing a game of tic-tac-toe and, thus, cannot start another one.";
static String ERROR_WIN_REQUIRED_AMOUNT_TOO_SMALL = "The required win amount must not be smaller than " + GameConfig.MIN_WIN_REQUIRED_AMOUNT;
static String ERROR_WIN_REQUIRED_AMOUNT_TOO_LARGE = "The required win amount must not be larger than the size's largest dimension.";
static String ERROR_WIN_REQUIRED_AMOUNT_TOO_LARGE = "The required win amount must not be larger than the size's largest dimension (%d).";

/**
* The player who started the game
Expand Down Expand Up @@ -108,7 +108,7 @@ List<String> validateNumbersReturningErrors(int maxDimensionSize) {
}

if(this.winRequiredAmount > this.getLargestDimension()) {
errors.add(GameConfig.ERROR_WIN_REQUIRED_AMOUNT_TOO_LARGE);
errors.add(String.format(GameConfig.ERROR_WIN_REQUIRED_AMOUNT_TOO_LARGE, this.getLargestDimension()));
}

if(this.winRequiredAmount < GameConfig.MIN_WIN_REQUIRED_AMOUNT) {
Expand Down

0 comments on commit 573f51c

Please sign in to comment.