-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathGameService.java
More file actions
24 lines (19 loc) · 823 Bytes
/
GameService.java
File metadata and controls
24 lines (19 loc) · 823 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
package racingcar.Service;
import racingcar.Model.Cars;
import java.util.List;
public class GameService {
private final RandomService randomService;
private final ClassificationService classificationService;
private final MovementService movementService;
public GameService(RandomService randomService, ClassificationService classificationService,
MovementService movementService) {
this.randomService = randomService;
this.classificationService = classificationService;
this.movementService = movementService;
}
public void gameRound(Cars racers) {
List<Integer> classifyCars =
classificationService.classifyValue(randomService.randomValue(racers.size()));
movementService.playRound(classifyCars, racers);
}
}