# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
main
Fan-Wu Yang 9 years ago
commit b15edd49d6

@ -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);

Loading…
Cancel
Save