-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGameUtils.java
More file actions
32 lines (24 loc) · 824 Bytes
/
GameUtils.java
File metadata and controls
32 lines (24 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package utils;
import inpututils.InputView;
import outpututils.OutputView;
import racingcar.Car;
import racingcar.Cars;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class GameUtils {
public static List<Car> makeCarList(String[] splitResult) {
return Arrays.stream(splitResult)
.map(Car::new)
.collect(Collectors.toList());
}
public static void run() {
String inputName = InputView.getCarName();
int inputCount = InputView.getTryNumber();
String[] splitResult = SplitString.splitString(inputName);
Cars cars = new Cars(makeCarList(splitResult));
Cars.playGames(inputCount);
Cars.setWinnerList(Cars.getMax());
OutputView.printWinner(Cars.getWinnerList());
}
}