Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
gkfla668 committed May 1, 2022
1 parent 40ca6a4 commit 83483da
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/controller/LadderGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void printPlayerResult(GameResult gameResult, String name) {
Map<String, String> results = gameResult.getGameResult();

if (results.get(name) == null) {
OutputView.printPlayerErrorMessage();
System.out.println("해당 플레이어는 존재하지 않습니다. \n다시 입력 해 주세요.");
return;
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/model/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ public static boolean isValidPlayerCount(String[] names) {
public static boolean isValidPrizeCount(int prizesCount, int playersCount) {
return prizesCount == playersCount;
}

}
5 changes: 3 additions & 2 deletions src/main/java/view/InputView.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Scanner;

public class InputView {
public static final String INPUT_POSITIVE_NUMBER_ERROR_MESSAGE = "양수를 입력 해 주세요.";
static Scanner scanner = new Scanner(System.in);

public static String inputPlayersNames() {
Expand All @@ -27,10 +28,10 @@ public static int inputHeight() {
if (height > 0) {
break;
}else{
System.out.println("높이는 1 이상이여야 합니다.");
System.out.println(INPUT_POSITIVE_NUMBER_ERROR_MESSAGE);
}
} catch (InputMismatchException e) {
System.out.println("정수를 입력 해 주세요.");
System.out.println(INPUT_POSITIVE_NUMBER_ERROR_MESSAGE);
scanner.nextLine();
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/view/OutputView.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
public class OutputView {
public static final String GAME_RESULT_MESSAGE = "\n실행 결과";

public static void printPlayerErrorMessage() {
System.out.println("해당 플레이어는 존재하지 않습니다. \n다시 입력 해 주세요.");
}

public static void printPlayersNames(List<String> players) {
System.out.println("\n사다리 결과\n");
for (String playerName : players)
Expand All @@ -23,7 +19,7 @@ public static void printLine(List<Boolean> line) {

for (int i = 0; i < line.size(); i++) {
boolean point = line.get(i);
printPoint(point, i, lastIdx);
printLinePoint(point, i, lastIdx);
}

System.out.println("");
Expand All @@ -47,7 +43,7 @@ public static void printAllGameResult(Map<String, String> gameResult) {
System.out.println(name + " : " + gameResult.get(name));
}

private static void printPoint(boolean point, int pointIdx, int lastIdx) {
private static void printLinePoint(boolean point, int pointIdx, int lastIdx) {
if (point) {
if (pointIdx != lastIdx) {
System.out.print("| ----- ");
Expand Down

0 comments on commit 83483da

Please sign in to comment.