started method calculateWinner

This commit is contained in:
Leonardo Brandenberger 2022-03-14 00:17:45 +01:00
parent af6914f795
commit e94053fee8
1 changed files with 40 additions and 0 deletions

View File

@ -266,6 +266,46 @@ public class Game implements GameSpecification {
return pathList; return pathList;
} }
private void calculateWinner(PositionVector start, PositionVector finish, int carIndex ){
List<PositionVector> path = calculatePath(start, finish);
for (PositionVector point : path){
switch (track.getSpaceType(point)) {
case FINISH_UP:
if(start.getY() < finish.getY()) {
//track.getCar(carIndex).addWinPoint;
//TODO: add point
}
else if( start.getY() < finish.getY()) {
//TODO: deduct point
}
break;
case FINISH_DOWN:
if(start.getY() > finish.getY()){
//track.getCar(carIndex).addWinPoint;
}
else if (start.getY() < finish.getY()){
}
break;
case FINISH_RIGHT:
if(start.getX() < finish.getX()){
//track.getCar(carIndex).addWinPoint;
}
else if (start.getX() < finish.getX()){
}
break;
case FINISH_LEFT:
if(start.getX() > finish.getX()){
//track.getCar(carIndex).addWinPoint;
}
else if (start.getX() < finish.getX()){
}
}
}
}
/** /**