@Override public void onRoundStarted(RoundStartedEvent event) { currentRound = event.getRound(); currentTurn = 0; recordmanager.writeTurn(event.getStartSnapshot(), currentRound, currentTurn); }
@Override public void onRoundStarted(final RoundStartedEvent event) { if (lastMajorEvent.get() == majorEvent.get()) { snapshot.set(event.getStartSnapshot()); } majorEvent.incrementAndGet(); EventQueue.invokeLater(new Runnable() { public void run() { awtOnTurnEnded(true, false); battleEventDispatcher.onRoundStarted(event); lastMajorEvent.incrementAndGet(); } }); }
@Override protected void initializeRound() { super.initializeRound(); final ITurnSnapshot snapshot = recordManager.readSnapshot(currentTime); if (snapshot != null) { eventDispatcher.onRoundStarted(new RoundStartedEvent(snapshot, getRoundNum())); } }
@Override protected void initializeRound() { super.initializeRound(); inactiveTurnCount = 0; // Start robots long waitMillis; int waitNanos; if (isDebugging()) { waitMillis = DEBUG_TURN_WAIT_MILLIS; waitNanos = 0; } else { long waitTime = Math.min(300 * cpuConstant, 10000000000L); waitMillis = waitTime / 1000000; waitNanos = (int) (waitTime % 1000000); } for (RobotPeer robotPeer : getRobotsAtRandom()) { robotPeer.startRound(waitMillis, waitNanos); } Logger.logMessage(""); // puts in a new-line in the log message final ITurnSnapshot snapshot = new TurnSnapshot(this, robots, bullets, false); eventDispatcher.onRoundStarted(new RoundStartedEvent(snapshot, getRoundNum())); }
public void onRoundStarted(final RoundStartedEvent event) { if (event.getRound() == 0) { getRobotButtonsPanel().removeAll(); final List<IRobotSnapshot> robots = Arrays.asList(event.getStartSnapshot().getRobots()); dialogManager.trim(robots); int maxEnergy = 0; for (IRobotSnapshot robot : robots) { if (maxEnergy < robot.getEnergy()) { maxEnergy = (int) robot.getEnergy(); } } if (maxEnergy == 0) { maxEnergy = 1; } for (int index = 0; index < robots.size(); index++) { final IRobotSnapshot robot = robots.get(index); final boolean attach = index < RobotDialogManager.MAX_PRE_ATTACHED; final RobotButton button = net.sf.robocode.core.Container.createComponent(RobotButton.class); button.setup(robot.getName(), maxEnergy, index, robot.getContestantIndex(), robot.getTeamIndex(), attach); button.setText(robot.getShortName()); addRobotButton(button); } getRobotButtonsPanel().repaint(); } }