Skip to content

Commit a16726a

Browse files
committed
[REFACTOR] OutputView 메서드 순서 수정(5단계)
1 parent 9763754 commit a16726a

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

src/main/java/domain/LadderGame.java

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public class LadderGame {
77

88
public List<Player> createPlayer(List<String> playerNames) {
99
List<Player> players = new ArrayList<>();
10-
1110
for (int i = 0; i < playerNames.size(); i++) {
1211
players.add(new Player(playerNames.get(i), i));
1312
}

src/main/java/domain/LadderGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private boolean randomTrueOrFalse() {
1414
}
1515

1616
private boolean createValue(List<Boolean> line, int index) {
17-
if (index != 0 && line.get(index - 1) == TRUE) // 이전 값이 True면 false 반환
17+
if (index != 0 && line.get(index - 1) == TRUE) // 이전 값이 true 면 false 반환
1818
return false;
1919

2020
return randomTrueOrFalse();

src/main/java/domain/Player.java

-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ public Player(String name,int position) {
1111

1212
public void moveLeft(){
1313
position--;
14-
System.out.println(getName()+getPosition());
1514
}
1615

1716
public void moveRight(){
1817
position++;
19-
System.out.println(getName()+getPosition());
2018
}
2119

2220
public String getName(){

src/main/java/view/InputView.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static int inputHeight(){
2929
}
3030

3131
public static String inputViewerName(){
32-
System.out.println("결과를 보고 싶은 사람은?");
32+
System.out.println("\n결과를 보고 싶은 사람은?");
3333
return input.nextLine();
3434
}
3535
}

src/main/java/view/OutputView.java

+12-14
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
import static java.lang.Boolean.TRUE;
1111

1212
public class OutputView {
13+
14+
public static void printPlayers(List<String> names) {
15+
System.out.println("\n사다리 결과\n");
16+
names.forEach(System.out::print);
17+
System.out.println();
18+
}
19+
1320
private static String changeValueToView(Boolean point) {
1421
if (point == TRUE)
1522
return "-----";
@@ -25,13 +32,10 @@ private static void drawLine(Line line) {
2532
System.out.println("|");
2633
}
2734

28-
public static void printPlayers(List<String> names) {
29-
System.out.println("\n사다리 결과\n");
30-
System.out.println();
31-
for (String name : names) {
32-
System.out.print(name);
35+
public static void drawLadder(Ladder Ladder) {
36+
for (Line lines : Ladder.getLadder()) {
37+
drawLine(lines);
3338
}
34-
System.out.println();
3539
}
3640

3741
public static void printKindOfResults(List<String> kindOfResults) {
@@ -41,15 +45,9 @@ public static void printKindOfResults(List<String> kindOfResults) {
4145
System.out.println();
4246
}
4347

44-
public static void drawLadder(Ladder Ladder) {
45-
for (Line lines : Ladder.getLadder()) {
46-
drawLine(lines);
47-
}
48-
}
49-
50-
private static void printAllResult(Players players, List<String> kindOfResults) {
48+
public static void printAllResult(Players players, List<String> kindOfResults) {
5149
for (Player player : players.getPlayers()) {
52-
System.out.println(player.getName() + " :" + kindOfResults.get(player.getPosition()));
50+
System.out.println(player.getName() + " : " + kindOfResults.get(player.getPosition()));
5351
}
5452
}
5553

0 commit comments

Comments
 (0)