Skip to content

Commit

Permalink
feat(Position): 달린 만큼 -를 출력
Browse files Browse the repository at this point in the history
  • Loading branch information
homebdy committed Sep 8, 2023
1 parent 7bbee81 commit bededc2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/racingcar/domain/Position.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class Position {

private static final String RACING_LINE = "-";
private int value = 0;

public void move() {
Expand All @@ -22,4 +23,12 @@ private int pickRandomNumber() {
int end = RandomNumber.END_RANGE.getValue();
return Randoms.pickNumberInRange(start, end);
}

public String getValue() {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < value; i++) {
stringBuilder.append(RACING_LINE);
}
return stringBuilder.toString();
}
}

0 comments on commit bededc2

Please sign in to comment.