Re: Override default inactivity time
fnl <[email protected]> Tue, 10 Apr 2018 13:32:10 -0700 (PDT)
| Newsgroups | gmane.comp.java.robocode |
|---|---|
| Message-ID | <[email protected]> |
Hi Tom, I guess you mean if the RobocodeEngine provide an API for setting the inactivity time and other battle rules as well? The RobocodeEngine has these 3 methods, where you can provide a BattleSpecification: void runBattle <http://robocode.sourceforge.net/docs/robocode/robocode/control/RobocodeEngine.html#runBattle-robocode.control.BattleSpecification-> (BattleSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/BattleSpecification.html> battleSpecification) Runs the specified battle. void runBattle <http://robocode.sourceforge.net/docs/robocode/robocode/control/RobocodeEngine.html#runBattle-robocode.control.BattleSpecification-boolean-> (BattleSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/BattleSpecification.html> battleSpecification, boolean waitTillOver) Runs the specified battle. void runBattle <http://robocode.sourceforge.net/docs/robocode/robocode/control/RobocodeEngine.html#runBattle-robocode.control.BattleSpecification-java.lang.String-boolean-> (BattleSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/BattleSpecification.html> battleSpecification, String <http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true> initialPositions, boolean waitTillOver) Runs the specified battle. A BattleSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/BattleSpecification.html>has various constructors, where you must provide the battle rules like e.g. the inactivity time: BattleSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/BattleSpecification.html#BattleSpecification-robocode.control.BattlefieldSpecification-int-long-double-int-boolean-robocode.control.RobotSpecification:A-robocode.control.RobotSetup:A-> (BattlefieldSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/BattlefieldSpecification.html> battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, boolean hideEnemyNames, RobotSpecification <http://robocode.sourceforge.net/docs/robocode/robocode/control/RobotSpecification.html> [] robots, RobotSetup <http://robocode.sourceforge.net/docs/robocode/robocode/control/RobotSetup.html> [] initialSetups) So yes, it is possible to do. :-) When not using the RobocodeEngine, a .battle file can be saved, which can can be specified using the -battle option for Robocode when starting. Robocode will automatically start a battle with the rules and robots specified in the .battle file. I hope this helps? Best regards, - Flemming Den tirsdag den 10. april 2018 kl. 15.05.36 UTC+2 skrev Tom Plum: > > Is there anyway to override the default inactivity time of 450 turns in > the BattleRules? I can't find any public setter in the API. But the > getInactivityTime() method in the BattleRules Class says > > > "The allowed inactivity time is per default 450 turns, but can be changed >> by the battle setup. So don't count on the inactivity time being 450 turns!" > > > So does this mean I can change the configuration of the BattleRules? > > -- You received this message because you are subscribed to the Google Groups "robocode" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.