diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index d3b2ee1..858486f 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -266,6 +266,46 @@ public class Game implements GameSpecification { return pathList; } + private void calculateWinner(PositionVector start, PositionVector finish, int carIndex ){ + List 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()){ + + } + } + } + + } /**