Timer is now in race loop
-Timer is currently printing out -Later will implement so that it is displayed on gui #story [16]
This commit is contained in:
@@ -99,7 +99,7 @@ public class RaceController extends Controller{
|
||||
|
||||
BoatInRace boat = new BoatInRace("NZ", 10000);
|
||||
BoatInRace[] boats = new BoatInRace[] {boat};
|
||||
Leg leg1 = new Leg("first leg", 1, new GPSCoordinate(0, 0), new GPSCoordinate(1, 1), 0);
|
||||
Leg leg1 = new Leg("first leg", 80, new GPSCoordinate(0, 0), new GPSCoordinate(200, 280), 0);
|
||||
Leg[] legs = new Leg[] {leg1};
|
||||
|
||||
ConstantVelocityRace race = new ConstantVelocityRace(boats, legs, this);
|
||||
@@ -135,8 +135,7 @@ public class RaceController extends Controller{
|
||||
displayLine(startline1, startline2, Color.GREEN);
|
||||
|
||||
//display wind direction arrow - specify origin point and angle
|
||||
displayPoint(this.map.convertGPS(32.293771, -64.855242), Color.BLACK);
|
||||
displayArrow(new GraphCoordinate(500, 20), 100);
|
||||
displayArrow(new GraphCoordinate(500, 20), 0);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,10 +63,20 @@ public abstract class Race implements Runnable {
|
||||
|
||||
long timeLoopStarted;
|
||||
long timeLoopEnded;
|
||||
long minutes;
|
||||
long currentTimeInSeconds;
|
||||
long remainingSeconds;
|
||||
|
||||
|
||||
while (finishingBoats.size() < startingBoats.length) {
|
||||
timeLoopStarted = System.currentTimeMillis();
|
||||
totalTimeElapsed = System.currentTimeMillis() - timeRaceStarted;
|
||||
long currentTime = System.currentTimeMillis() - timeRaceStarted;
|
||||
currentTimeInSeconds = currentTime / 1000;
|
||||
minutes = currentTimeInSeconds / 60;
|
||||
remainingSeconds = currentTimeInSeconds % 60;
|
||||
System.out.println(minutes + ":" + remainingSeconds);
|
||||
|
||||
for (BoatInRace boat : startingBoats) {
|
||||
updatePosition(boat, SLEEP_TIME);
|
||||
checkPosition(boat, totalTimeElapsed);
|
||||
|
||||
Reference in New Issue
Block a user