Rounding marks works.

main
Joseph Gardner 9 years ago
parent a50d460222
commit 37fe7389ff

@ -299,7 +299,6 @@ public class MockRace extends Race {
} }
/** /**
* Calculates the distance a boat has travelled and updates its current position according to this value. * Calculates the distance a boat has travelled and updates its current position according to this value.
* *
@ -314,6 +313,8 @@ public class MockRace extends Race {
if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds & boat.isSailsOut()) { if (!finish && totalElapsedMilliseconds >= updatePeriodMilliseconds & boat.isSailsOut()) {
checkPosition(boat, totalElapsedMilliseconds);
setBoatSpeed(boat); setBoatSpeed(boat);
//Calculates the distance travelled, in meters, in the current timeslice. //Calculates the distance travelled, in meters, in the current timeslice.
@ -515,7 +516,7 @@ public class MockRace extends Race {
if (boat.isStarboardSide(roundingMark) && if (boat.isStarboardSide(roundingMark) &&
GPSCoordinate.passesLine(roundingMark.getPosition(), GPSCoordinate.passesLine(roundingMark.getPosition(),
roundingChecks.get(0), boat.getPosition(), legBearing) && roundingChecks.get(0), boat.getPosition(), legBearing) &&
gateCheck && gateCheck &&
boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) { boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) {
boat.increaseRoundingStatus(); boat.increaseRoundingStatus();
if (boat.getCurrentLeg().getLegNumber() + 2 >= legs.size()){ if (boat.getCurrentLeg().getLegNumber() + 2 >= legs.size()){

@ -180,9 +180,9 @@ public class RaceLogic implements RunnableWithFramePeriod, Observer {
public void update(Observable o, Object arg) { public void update(Observable o, Object arg) {
Collision e = (Collision)arg; Collision e = (Collision)arg;
if(e.getBearing().degrees() == 0) System.out.println("Ahead"); // if(e.getBearing().degrees() == 0) System.out.println("Ahead");
else if(e.getBearing().degrees() < 90) System.out.println("Starboard"); // else if(e.getBearing().degrees() < 90) System.out.println("Starboard");
else if(e.getBearing().degrees() > 270) System.out.println("Port"); // else if(e.getBearing().degrees() > 270) System.out.println("Port");
else System.out.println("Behind"); // else System.out.println("Behind");
} }
} }
Loading…
Cancel
Save