From 82911fcfb6323a8159d5f120abd0de4a7b7f0081 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:45:15 +0100 Subject: [PATCH] merge Game.java --- .../racetrack/strategy/PathFinderMoveStrategy.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java b/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java index 12d07a9..51026d0 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/strategy/PathFinderMoveStrategy.java @@ -1,7 +1,6 @@ package ch.zhaw.pm2.racetrack.strategy; import ch.zhaw.pm2.racetrack.PositionVector; -import ch.zhaw.pm2.racetrack.PositionVectorNotValid; import ch.zhaw.pm2.racetrack.Track; import java.util.*; @@ -93,14 +92,11 @@ public class PathFinderMoveStrategy implements MoveStrategy{ } public boolean crashed() { - try { - for(PositionVector point : track.calculatePointsOnPath(positions.get(positions.size()-1), positions.get(positions.size()-2))) - if(track.willCrashAtPosition(carIndex, point)){ - return true; + for(PositionVector point : track.calculatePointsOnPath(positions.get(positions.size()-1), positions.get(positions.size()-2))) { + if (track.willCrashAtPosition(carIndex, point)) { + return true; + } } - } catch (PositionVectorNotValid e) { - return true; - } return false; }