Game #23

Merged
schrom01 merged 43 commits from Game into main 2022-03-20 16:56:34 +01:00
1 changed files with 7 additions and 8 deletions
Showing only changes of commit 9869e8e74d - Show all commits

View File

@ -128,10 +128,9 @@ public class Game implements GameSpecification {
if (onlyOneCarLeft()) { if (onlyOneCarLeft()) {
return currentCarIndex; return currentCarIndex;
} }
List<Car> cars = track.getCars(); for (int i = 0; i < track.getCarCount(); i++) {
for (Car car : cars) { if (track.getCar(i).getWinPoints() == 1) {
if (car.getWinPoints() == 1) { return i;
return car.getID(); // TODO: Index not ID
} }
} }
return NO_WINNER; return NO_WINNER;
@ -295,7 +294,7 @@ public class Game implements GameSpecification {
for (PositionVector point : path) { for (PositionVector point : path) {
if (track.getSpaceType(point) != null) if (track.getSpaceType(point) != null)
{ {
switch (track.getSpaceType(point)) { //TODO: Case null switch (track.getSpaceType(point)) {
case FINISH_UP: case FINISH_UP:
if (start.getY() < finish.getY()) { if (start.getY() < finish.getY()) {
track.getCar(carIndex).increaseWinPoints(); track.getCar(carIndex).increaseWinPoints();