|
|
|
@ -95,7 +95,7 @@ public abstract class Race implements Runnable {
|
|
|
|
System.out.println(minutes + ":" + remainingSeconds);
|
|
|
|
System.out.println(minutes + ":" + remainingSeconds);
|
|
|
|
|
|
|
|
|
|
|
|
for (BoatInRace boat : startingBoats) {
|
|
|
|
for (BoatInRace boat : startingBoats) {
|
|
|
|
if (boat != null) {
|
|
|
|
if (boat != null && !boat.isFinished()) {
|
|
|
|
updatePosition(boat, SLEEP_TIME);
|
|
|
|
updatePosition(boat, SLEEP_TIME);
|
|
|
|
checkPosition(boat, totalTimeElapsed);
|
|
|
|
checkPosition(boat, totalTimeElapsed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -123,8 +123,8 @@ public abstract class Race implements Runnable {
|
|
|
|
//boat has passed onto new leg
|
|
|
|
//boat has passed onto new leg
|
|
|
|
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
|
|
|
if (boat.getCurrentLeg().getName().equals("Finish")) {
|
|
|
|
//boat has finished
|
|
|
|
//boat has finished
|
|
|
|
boat.setTimeFinished(timeElapsed);
|
|
|
|
|
|
|
|
boatsFinished++;
|
|
|
|
boatsFinished++;
|
|
|
|
|
|
|
|
boat.setFinished(true);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg() - boat.getCurrentLeg().getDistance());
|
|
|
|
boat.setDistanceTravelledInLeg(boat.getDistanceTravelledInLeg() - boat.getCurrentLeg().getDistance());
|
|
|
|
Leg nextLeg = legs.get(boat.getCurrentLeg().getLegNumber() + 1);
|
|
|
|
Leg nextLeg = legs.get(boat.getCurrentLeg().getLegNumber() + 1);
|
|
|
|
|