### Robocode: Installer Instructions Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet notes a change where the installer now correctly instructs users to run robocode.jar, resolving previous confusion or incorrect instructions. ```Java // Installer update: Ensure the instructions clearly state to run the robocode.jar file. // Example instruction: "To run Robocode, execute: java -jar robocode.jar" ``` -------------------------------- ### Publish to Staging Repository Source: https://github.com/robo-code/robocode/blob/main/publish.md Publishes Robocode binaries to the Sonatype staging repository using the Gradle build tool. ```gradle ./gradlew publishToSonatype ``` -------------------------------- ### Publish to Chocolatey Source: https://github.com/robo-code/robocode/blob/main/publish.md Publishes the Robocode package to the Chocolatey repository, requiring the CHOCOLATEY_API_KEY environment variable to be set. ```gradle ./gradlew chocoPush ``` -------------------------------- ### Setting JAVA_HOME Environment Variable for Robocode Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/ReadMe.html This snippet demonstrates how to set the JAVA_HOME environment variable, which is crucial for Robocode to locate the Java installation. It provides examples for both Windows and Linux/macOS operating systems. ```shell Windows example: JAVA_HOME=C:\Program Files\AdoptOpenJDK\jdk-16.0.0.36-hotspot ``` ```shell Linux and macOS example: JAVA_HOME=/usr/lib/jvm/adoptopenjdk-16-hotspot-amd64 ``` -------------------------------- ### Release to Public Repositories Source: https://github.com/robo-code/robocode/blob/main/publish.md Closes and releases the staging repository on Sonatype, making Robocode binaries available in public repositories like Maven Central. ```gradle ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository ``` -------------------------------- ### Configure Gradle for Signing Source: https://github.com/robo-code/robocode/blob/main/publish.md Sets up the 'gradle.properties' file with GPG key details, password, secret key ring file path, and Sonatype credentials for publishing. ```properties signing.keyId= signing.password= signing.secretKeyRingFile=~/.gnupg/secring.gpg ossrhUsername= ossrhPassword= ``` -------------------------------- ### Export Public GPG Key Source: https://github.com/robo-code/robocode/blob/main/publish.md Exports the public GPG key to an armor-formatted file named 'public-key.pub', which is then uploaded to a keyserver. ```shell gpg --export --armor --output public-key.pub ``` -------------------------------- ### Create GPG Key Source: https://github.com/robo-code/robocode/blob/main/publish.md Generates a new GPG key with RSA 4096 encryption, essential for signing releases published to Maven repositories. ```shell gpg --default-new-key-algo rsa4096 --gen-key ``` -------------------------------- ### Install Robocode via Chocolatey Source: https://github.com/robo-code/robocode/blob/main/versions.md Provides instructions for installing Robocode on Windows using the Chocolatey package manager. This ensures proper dependency management, including OpenJDK. ```Shell choco install robocode ``` -------------------------------- ### Export Secret GPG Keys Source: https://github.com/robo-code/robocode/blob/main/publish.md Exports the secret GPG keys to 'secring.gpg' within the user's .gnupg directory, required for signing releases. ```shell gpg --keyring secring.gpg --export-secret-keys > [user-home-dir]/.gnupg/secring.gpg ``` -------------------------------- ### List Secret GPG Keys Source: https://github.com/robo-code/robocode/blob/main/publish.md Lists secret GPG keys, allowing retrieval of the last 8 digits of the secret key ID needed for Gradle configuration. ```shell gpg -K ``` -------------------------------- ### Get SHA256 Checksum using Chocolatey Checksum Utility Source: https://github.com/robo-code/robocode/blob/main/robocode.installer/src/chocolatey/tools/VERIFICATION.txt This snippet shows how to use the `checksum.exe` utility, often bundled with Chocolatey, to compute the SHA256 checksum of the RoboCode installer. This is a convenient method for users within the Chocolatey ecosystem. ```bash checksum.exe robocode-1.9.5.3-setup.jar ``` -------------------------------- ### RoboRumble Participant Configuration Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Defines URLs and file paths for RoboRumble participants. This includes a URL for fetching participants and a local file path for participant data, along with a start tag and a URL for updating bots. ```properties PARTICIPANTSURL=https://robowiki.net/wiki/RoboRumble/Participants?action=raw PARTICIPANTSFILE=./roborumble/files/particip1v1.txt STARTAG=pre UPDATEBOTSURL=https://literumble.appspot.com/RemoveOldParticipant ``` -------------------------------- ### Get SHA256 Checksum using PowerShell Source: https://github.com/robo-code/robocode/blob/main/robocode.installer/src/chocolatey/tools/VERIFICATION.txt This snippet demonstrates how to use the PowerShell `Get-FileHash` cmdlet to calculate the SHA256 checksum of the RoboCode installer file. This is a common method for verifying file integrity on Windows systems. ```powershell Get-FileHash robocode-1.9.5.3-setup.jar ``` -------------------------------- ### Robocode Initial Positions and Headings API Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces initial positions and headings to the Control API via a new BattleSpecification constructor and the RobotSetup class, allowing precise robot placement and orientation at the start of a battle. ```Java import robocode.control.BattleSpecification; import robocode.control.RobotSetup; // ... inside a method or constructor ... // Example of setting initial positions and headings RobotSetup[] initialSetups = { new RobotSetup(0, 0, 0), // Robot 1 at (0,0) with heading 0 new RobotSetup(100, 100, 90) // Robot 2 at (100,100) with heading 90 }; BattleSpecification battleSpec = new BattleSpecification(1000, 1000, 100, "robot1,robot2", null, initialSetups); // RobocodeEngine engine = new RobocodeEngine(new File("path/to/robocode")); // engine.runBattle(battleSpec, true); ``` -------------------------------- ### Robocode GUI Disabled Behavior Source: https://github.com/robo-code/robocode/blob/main/versions.md Fixes issues related to the `sample.SittingDuck` not starting when the GUI is disabled and the Look and Feel not being set in the absence of a GUI. ```Java // The sample.SittingDuck would not start when no GUI is enabled. // The Look and Feel is not set if the GUI is disabled. ``` -------------------------------- ### Fix Robocode Startup with `robocode.sh` on Linux/macOS Source: https://github.com/robo-code/robocode/blob/main/versions.md Addresses an issue where Robocode would not start on Linux and macOS when executing the `robocode.sh` script due to a `java.lang.UnsupportedOperationException` related to the deprecated Security Manager. ```Shell # Fix for robocode.sh script on Linux/macOS # Addresses java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release # Thanks to @scientificworld for this fix. ``` -------------------------------- ### Enable Robot Painting Source: https://github.com/robo-code/robocode/blob/main/versions.md You can enable robot painting on the screen by setting the Java system property `-DPAINTING=true` when starting Robocode. ```Java -DPAINTING=true ``` -------------------------------- ### Robocode Teams: Creating and Managing Robot Teams Source: https://github.com/robo-code/robocode/blob/main/versions.md This section details the introduction of Teams in Robocode, allowing multiple robots to cooperate. It explains how to create TeamRobots, form a Team, the role of the team leader, scoring mechanics, and packaging teams. It references `sampleteam.MyFirstTeam` as an example. ```Java public class MyFirstTeam extends TeamRobot { public void run() { // Team robot logic here } } ``` -------------------------------- ### RoboCode IDE Integration Setup Source: https://github.com/robo-code/robocode/blob/main/versions.md Explains how to configure RoboCode to work with external Integrated Development Environments (IDEs) like Eclipse. This involves adding the path to your robot project in the RoboCode preferences. ```Java Found in Options->Preferences. Simply add the path to your robot project. As usual, robots will be loaded from disk at the start of each battle. ``` -------------------------------- ### Robocode Exception Handling Examples Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet lists various exceptions encountered and fixed in different Robocode versions. These include NullPointerExceptions, ArrayOutOfBoundsExceptions, and other runtime errors that affected robot execution and stability. ```Java java.lang.Error: Interrupted attempt to aquire read lock NullPointerException ArrayIndexOutOfBoundsException WinException ``` -------------------------------- ### Debugging Robocode with Eclipse Source: https://github.com/robo-code/robocode/blob/main/versions.md To debug robots from Eclipse, start Robocode with the `-Ddebug=true` option in your VM arguments. This is necessary to avoid `TimeoutExceptions` when resuming from a breakpoint. ```bash java -Ddebug=true -jar robocode.jar ``` -------------------------------- ### RobocodeEngine: Add runBattle with initial positions Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces an overloaded `runBattle()` method in the `RobocodeEngine` control class. This allows developers to specify the initial positions of robots when starting a battle, providing more control over battle simulations. ```Java public void runBattle(BattleProperties battleProperties, RobotSpecification[] robotSpecifications, Point[] initialPositions) ``` -------------------------------- ### Add Kotlin Support to Robocode Source: https://github.com/robo-code/robocode/blob/main/versions.md To enable robots coded in Kotlin, you need to include the `kotlin-stdlib-1.xxx.jar` file in the `/libs` folder of your Robocode installation. This allows the Robocode engine to compile and run Kotlin-based robots. ```Java Place kotlin-stdlib-1.xxx.jar in the /libs folder. ``` -------------------------------- ### Specify Robot Initial Positions in Robocode Battle Source: https://github.com/robo-code/robocode/blob/main/versions.md This feature allows developers to define the starting positions and headings of robots on the battlefield by setting the `robocode.battle.initialPositions` property in a battle file. The format specifies coordinates and headings for each robot, with options for random placement. ```properties robocode.battle.initialPositions = (x1,y1,heading1),(x2,y2,heading2),(?,?,?) ``` ```properties (50,50,90),(100,100,?),? ``` -------------------------------- ### Conditional Intro Battle Display Source: https://github.com/robo-code/robocode/blob/main/versions.md Changes the behavior of the intro battle display. It will now only be shown if no battle file is specified via the `-battle` argument and it's the first run since installation. Previously, it always displayed. ```Java /* * Intro battle now only shown if no -battle arg is used and it's the first run. * Previously shown regardless of -battle argument. */ ``` -------------------------------- ### Get Current Working Directories in RobocodeEngine Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet demonstrates how to retrieve the current working directory and the robots directory using the `RobocodeEngine` class. These methods are useful for managing robot files and configurations within the Robocode environment. ```Java import robocode.control.RobocodeEngine; // ... inside a method or class context RobocodeEngine engine = new RobocodeEngine(); String currentDir = engine.getCurrentWorkingDir(); String robotsDir = engine.getRobotsDir(); System.out.println("Current Working Directory: " + currentDir); System.out.println("Robots Directory: " + robotsDir); ``` -------------------------------- ### Robocode Filesystem Quota Configuration Source: https://github.com/robo-code/robocode/blob/main/versions.md Defines a property in 'robocode.properties' to set the default filesystem quota for robots. This is a temporary measure to control file storage. The example shows setting a quota of 200,000 bytes. ```Properties robocode.robot.filesystem.quota=200000 ``` -------------------------------- ### Robocode Command Line Help Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/ReadMe.html Displays the help information for the Robocode command-line interface, outlining available options and predefined properties for running Robocode battles. ```Shell robocode -help ``` -------------------------------- ### Robocode Droids: Robots without Radar Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces Droids, a type of robot that lacks radar and scanning abilities, optimized for weight savings. Droids are created by implementing the `Droid` interface within a `TeamRobot`. They have reduced starting energy and their API remains largely unchanged, though scanning functions will not work. `sampleteam.MyFirstDroid` is provided as an example. ```Java public class MyFirstDroid extends TeamRobot implements Droid { public void run() { // Droid logic here } public void onScannedRobot(ScannedRobotEvent e) { // Scanning is not available for Droids } } ``` -------------------------------- ### Robocode Command Line Help Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/ReadMe.md Displays the usage instructions for Robocode command-line options. This is useful for understanding how to configure and run battles from the terminal. ```Shell robocode -help ``` -------------------------------- ### Get Robot Velocity Source: https://github.com/robo-code/robocode/blob/main/versions.md Retrieves the current velocity of the robot. This method is part of the Robot API. ```Java Robot.getVelocity() ``` -------------------------------- ### Get Bullet Heading in Degrees Source: https://github.com/robo-code/robocode/blob/main/versions.md Retrieves the heading of a bullet in degrees. This method is part of the Bullet API. ```Java Bullet.getHeading() ``` -------------------------------- ### Get Bullet Heading in Radians Source: https://github.com/robo-code/robocode/blob/main/versions.md Retrieves the heading of a bullet in radians. This method is part of the Bullet API. ```Java Bullet.getHeadingRadians() ``` -------------------------------- ### Run Robocode Battle from Command Line Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet demonstrates how to initiate a Robocode battle using command-line parameters. It specifies the battle file, output file for results, frames per second, and an option to minimize the window. ```bash robocode -battle battles\sample.battle -results out.txt -fps 250 -minimize ``` -------------------------------- ### Robocode API: Get Time Source: https://github.com/robo-code/robocode/blob/main/versions.md Adds the `getTime()` method to the `Robot` class, returning the current game tick. ```Java public long getTime(); ``` -------------------------------- ### RoboRumble Configuration - Basic Settings Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Sets up essential parameters for RoboRumble, including the username for uploads, exclusion filters, and core execution properties like downloading, executing, and uploading results. It also defines whether the rumble runs iteratively. ```properties USER=Put_Your_Name_Here EXCLUDE= DOWNLOAD=YES EXECUTE=YES UPLOAD=YES ITERATE=YES ``` -------------------------------- ### RoboRumble Configuration - File Paths Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Defines the input and output file paths for RoboRumble. The input file is used for selecting robots for battles, while the output file stores the battle results. ```properties INPUT=./roborumble/temp/battles1v1.txt OUTPUT=./roborumble/files/results1v1.txt ``` -------------------------------- ### Robocode API: Get Fire Delay Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces the `getFireDelay()` method to the `Robot` class, which returns the current delay before the robot can fire again. ```Java public int getFireDelay(); ``` -------------------------------- ### Get Robocode Data Directory (Java) Source: https://github.com/robo-code/robocode/blob/main/versions.md Retrieves the data directory for a robot, which is a java.io.File object. This is useful for storing and accessing robot-specific data. ```Java java.io.File dataDirectory = getDataDirectory(); ``` -------------------------------- ### Robocode Launching from Battle Files Source: https://github.com/robo-code/robocode/blob/main/versions.md Allows Robocode to launch battles directly from .battle (battle specification) and .br (battle record) files, specifically supported on Windows. ```Shell # Example command to launch from a battle file: # robocode.bat -battle mybattle.battle ``` -------------------------------- ### Save Battle Record via Command Line Source: https://github.com/robo-code/robocode/blob/main/versions.md This shows how to use command-line options to save a battle record. The `-record ` option saves a binary, zipped battle record, while `-recordXML ` saves it in XML format. These are useful for analyzing battles or sharing results. ```Bash # Save battle as a binary record robocode.sh -record my_battle_record.br # Save battle as an XML record robocode.sh -recordXML my_battle_record.br.xml ``` -------------------------------- ### Configure Melee Rumble Settings Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/meleerumble.txt Sets up the RoboRumble for melee battles by defining key parameters such as user name, download and execution flags, battle dimensions, and participant counts. It also specifies input and output file paths for battle data. ```properties USER=Put_Your_Name_Here EXCLUDE= DOWNLOAD=YES EXECUTE=YES UPLOAD=YES ITERATE=YES MELEE=YES TEAMS=NOT FIELDL=1000 FIELDH=1000 NUMBATTLES=3 ROUNDS=35 MELEEBOTS=10 INPUT=./roborumble/temp/battlesmelee.txt OUTPUT=./roborumble/files/resultsmelee.txt BOTSREP=./robots/ TEMP=./roborumble/temp/ ``` -------------------------------- ### Robocode API: Get Gun Cooling Rate Source: https://github.com/robo-code/robocode/blob/main/versions.md Adds the `getGunCoolingRate()` method to the `Robot` class, allowing robots to query the rate at which their gun cools down after firing. ```Java public double getGunCoolingRate(); ``` -------------------------------- ### RoboRumble Configuration - Repository and Temp Paths Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Specifies the directories for storing downloaded robots (BOTSREP) and temporary files used by RoboRumble (TEMP). These paths are essential for managing robot assets and intermediate data. ```properties BOTSREP=./robots/ TEMP=./roborumble/temp/ ``` -------------------------------- ### RoboRumble Rating File Configuration Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Outlines properties for URLs and filenames related to downloading rating files for various RoboRumble competitions, including general, MiniBots, MicroBots, and NanoBots. ```properties RATINGS.URL RATINGS.GENERAL RATINGS.MINIBOTS RATINGS.MICROBOTS RATINGS.NANOBOTS ``` -------------------------------- ### Robocode Java Bug Fixes Source: https://github.com/robo-code/robocode/blob/main/versions.md Details bug fixes related to Java implementation in Robocode, such as output stream usage, installer exceptions, and package name validation. ```Java /* Bug-311]: `out.write(int)` uses up allocated printing quickly. */ /* Bug-318]: Installer throws `NumberFormatException` on Linux 3.0. */ /* Bug-319]: Package name allows bad chars. */ /* Bug-312]: Enabling Paint Freezes Robocode. */ /* Fixed problem with XML serialization of just killed robot. */ /* Fixed bug in temporary record cleanup. */ /* [Bug-302]: Hide enemy name implementation bug. */ /* [Bug-303]: `bullet.equals` semantic has been change in 1.7.3.0 version. */ /* [Bug-304]: `setColor(null)` causes NPE. */ /* [Bug-305]: TeamRumble priority battles bug. */ /* [Bug-306]: Rumble sh scripts for launching do not handle spaces in path. */ /* [Bug-307]: Console output cannot handle non-ascii names. */ /* [Bug-308]: `ConcurrentModificationException` in `URLJarCollector`. */ /* [Bug-309]: robot in development generates * into filename. */ /* [Bug-310]: Interface Robot skips turns at end of round. */ /* Bug: `BulletHitEvent.getBullet().getVictim()` always returned null. */ /* [Bug-301]: `getTurnRateRadians` incorrect for negative velocity. */ /* Fixed issues with unit-testing and building Robocode on Linux. */ /* [Bug-297]: x,y coords between `BulletHitEvent` & `HitByBulletEvent` differ. */ /* [Bug-299]: Custom events no longer firing after clearing event queue. */ /* Fixed typo in the documentation with valid range of values for the battlefield width and height. */ /* Fixed "3 * PI / 4 means West" in the Robot API, which should be "3 * PI / 2 means West". */ ``` -------------------------------- ### Robocode Command Line Options Source: https://github.com/robo-code/robocode/blob/main/versions.md Demonstrates command-line options for running Robocode, including `-tps` for turns per second and `-nodisplay` to prevent graphical components from loading. ```Shell # Set desired Turns Per Second (TPS) java -jar robocode.jar -tps 100 # Run Robocode without a graphical display java -jar robocode.jar -nodisplay ``` -------------------------------- ### Robocode Bug Fix - BulletHitBulletEvent Priority Source: https://github.com/robo-code/robocode/blob/main/versions.md This fix addresses a missing functionality for setting and getting the priority of a `BulletHitBulletEvent`. Methods for this purpose were added as they were previously absent in Robocode. ```Java [Bug-59]: Issue when setting the priority of a BulletHitBulletEvent. * Added methods for setting and getting the priority of BulletHitBulletEvent that was missing completely in Robocode?! ``` -------------------------------- ### Configure Participant Source Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/twinduel.txt Specifies the source for robot participants. This can be a URL pointing to a raw wiki page or a local file path. ```properties PARTICIPANTSURL=https://robowiki.net/wiki/RoboRumble/Participants/TwinDuel?action=raw PARTICIPANTSFILE=./roborumble/files/participTwinduel.txt ``` -------------------------------- ### Get Number of Sentries (.NET) Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces a new read-only property `NumSentries` for .NET robots. This property provides the count of sentry robots currently active on the battlefield. ```C# // Example usage in a .NET robot // Assuming 'robot' is an instance of your robot class int numberOfSentries = robot.NumSentries; ``` -------------------------------- ### Define Robot Repository and Temporary Directories (RoboCode) Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/twinduel.txt Sets the directories for storing downloaded robots and temporary files used by RoboRumble. BOTSREP is the path for the robot repository, and TEMP is the directory for temporary files. ```properties BOTSREP=./robots/ TEMP=./roborumble/temp/ ``` -------------------------------- ### Robocode onDeathEvent Timing Source: https://github.com/robo-code/robocode/blob/main/versions.md Fixes an issue where the onDeathEvent(DeathEvent) method was called too late, specifically when a new round was starting instead of immediately upon the robot's death. ```Java public void onDeath(DeathEvent e) { // Event handling logic for robot death } ``` -------------------------------- ### Specify Input and Output Files (RoboCode) Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/twinduel.txt Configures the input and output files for the RoboCode rumble. INPUT points to the file generated for robot selection, and OUTPUT specifies the file where battle results are stored. ```properties INPUT=./roborumble/temp/battlesTwinduel.txt OUTPUT=./roborumble/files/resultsTwinduel.txt ``` -------------------------------- ### Get Number of Sentries (Java) Source: https://github.com/robo-code/robocode/blob/main/versions.md Adds a new method `getNumSentries()` to the `Robot` and `RobotStatus` classes, and to the `IBasicRobotPeer` interface. This allows developers to retrieve the number of sentry robots present on the battlefield. ```Java /** * Returns the number of sentry robots on the battlefield. * @return the number of sentry robots */ public int getNumSentries(); ``` -------------------------------- ### Updating PATH Environment Variable for Robocode Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/ReadMe.html This snippet shows how to update the system's PATH environment variable to include the Java bin directory. This allows the Java executable to be found and run by Robocode. ```shell Windows example: PATH=%PATH%;%JAVA_HOME% ``` ```shell Linux, macOS example: PATH=${PATH}:${JAVA_HOME}/bin ``` -------------------------------- ### Robocode Music Configuration Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet shows how to configure music files for Robocode using properties in the robocode.properties file. It includes properties for the startup theme music, background music during battles, and music played at the end of a battle. ```properties file.music.theme=path/to/theme.mp3 file.music.background=path/to/background.mp3 file.music.endOfBattle=path/to/end_of_battle.mp3 ``` -------------------------------- ### Updating PATH Environment Variable for Java Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/ReadMe.md Illustrates how to update the PATH environment variable to include the Java executable. This allows the system to find and run Java commands, which is necessary for launching Robocode. ```Windows PATH=%PATH%;%JAVA_HOME% ``` ```Linux/macOS PATH=${PATH}:${JAVA_HOME}/bin ``` -------------------------------- ### Robocode Engine Battle Listener Interface Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces the `IBattleListener` interface within the `robocode.control` package, allowing the `RobocodeEngine` to provide detailed turn-by-turn information about battles. This enables capturing game states, robot/bullet states, and console messages for advanced analysis and control. ```Java package robocode.control; public interface IBattleListener { // Methods for receiving battle updates, robot states, messages, etc. // Example: // void onTurnEnded(TurnEndedEvent event); // void onRobotMessage(RobotMessageEvent event); } ``` -------------------------------- ### Get Bullet Information (Java) Source: https://github.com/robo-code/robocode/blob/main/versions.md Retrieves information about a bullet involved in a collision, such as the bullet that hit another bullet or the bullet that hit the current robot. This includes details like owner, power, and velocity. ```Java Bullet bullet = getBullet(); ``` -------------------------------- ### Enabling Experimental Robot Interfaces Source: https://github.com/robo-code/robocode/blob/main/versions.md To allow robots to access the internal robot peer for operations using the new robot interfaces, set the `EXPERIMENTAL` command line option to `true`. This is done by adding `-DEXPERIMENTAL=true` to the VM arguments. ```bash robocode.bat -DEXPERIMENTAL=true ``` ```bash robocode.sh -DEXPERIMENTAL=true ``` -------------------------------- ### Get Robocode Data File (Java) Source: https://github.com/robo-code/robocode/blob/main/versions.md Obtains a File object representing a specific file within the robot's data directory. This allows robots to easily access their persistent data files. ```Java java.io.File dataFile = getDataFile("my.dat"); ``` -------------------------------- ### RoboRumble Configuration - Participant Update URLs Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Outlines the URLs and file paths used for updating the list of participants in RoboRumble. This includes the URL for the participants list, the local file to store it, and tags for parsing the web page. ```properties PARTICIPANTSURL= PARTICIPANTSFILE= STARTAG= UPDATEBOTSURL= ``` -------------------------------- ### RoboCode Rumble Configuration Properties Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/meleerumble.txt This snippet defines various configuration properties for the RoboCode rumble. It includes URLs for fetching participant data, uploading results, and specifying file paths for participant lists, battle logs, and code size information. It also details settings for controlling battle execution, such as robot prioritization and categorization. ```properties PARTICIPANTSURL=https://robowiki.net/wiki/RoboRumble/Participants/Melee?action=raw PARTICIPANTSFILE=./roborumble/files/participmelee.txt STARTAG=pre UPDATEBOTSURL=https://literumble.appspot.com/RemoveOldParticipant RUNONLY=SERVER BATTLESPERBOT=2000 PRIORITYBATTLESFILE=./roborumble/temp/prioritymelee.txt RESULTSURL=https://literumble.appspot.com/UploadedResults BATTLESNUMFILE=./roborumble/temp/meleebattlesnumber.txt MINIBOTS=minimeleerumble MICROBOTS=micromeleerumble NANOBOTS=nanomeleerumble CODESIZEFILE=./roborumble/files/codesizemelee.txt ``` -------------------------------- ### Robocode Skipped Turn Event Source: https://github.com/robo-code/robocode/blob/main/versions.md Provides information about skipped turns in Robocode. The SkippedTurnEvent class includes a getSkippedTurn() method to retrieve the skipped turn number and getTime() to get the processing time of the event. ```Java public void onSkippedTurn(SkippedTurnEvent e) { int skippedTurn = e.getSkippedTurn(); long eventTime = e.getTime(); // Event handling logic here } ``` -------------------------------- ### Get Sentry Border Size (Java) Source: https://github.com/robo-code/robocode/blob/main/versions.md A new method `getSentryBorderSize()` has been added to the Robot classes. This method returns the size or attack range from the battlefield borders where BorderSentry robots can engage other robot types. ```Java /** * Returns the size of the sentry border, which defines the attack range from the edge of the battlefield. * @return the sentry border size */ public int getSentryBorderSize(); ``` -------------------------------- ### Configure Rumble Execution (RoboCode) Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/twinduel.txt Sets parameters to control the execution of RoboCode rumbles. DOWNLOAD enables data downloads, EXECUTE runs battles, UPLOAD sends results, and ITERATE allows continuous execution. MELEE and TEAMS flags specify battle types. ```properties DOWNLOAD=YES EXECUTE=YES UPLOAD=YES ITERATE=YES MELEE=NOT TEAMS=YES ``` -------------------------------- ### Example of preventing robot disabling with doNothing() Source: https://github.com/robo-code/robocode/blob/main/versions.md Demonstrates a common mistake in robot programming where a busy-wait loop can lead to the robot being disabled. The corrected version uses `doNothing()` to yield control and prevent disabling. ```Java bad: while (getGunHeat() != 0) {} good: while (getGunHeat() != 0) { doNothing(); } ``` -------------------------------- ### F# Sample Robots Source: https://github.com/robo-code/robocode/blob/main/versions.md This entry pertains to sample robots developed using the F# language, provided with the .NET plugin and accompanied by Visual Studio project files for development. ```F# // Example F# robot code structure open Robocode [] let inline createRobot() = let mutable robot = null { new AdvancedRobot() with member this.Run() = robot <- this this.TurnLeft(90) this.Ahead(100) member this.OnScannedRobot(e: ScannedRobotEvent) = // Handle scanned robot events () } createRobot() ``` -------------------------------- ### Robocode API: Fire Bullet and Get Bullet Object Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces the `fireBullet()` method, which functions similarly to `fire()` but returns a `Bullet` object. This enables developers to track and manage individual bullets fired by their robots. ```Java public Bullet fireBullet(double firePower); // Equivalent to fire(), but returns a Bullet object. ``` -------------------------------- ### RoboRumble Configuration - Battle Engine Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Configures the core battle engine parameters, including battlefield dimensions (width and height in pixels), the total number of battles to be performed, and the number of rounds per battle. ```properties FIELDL=800 FIELDH=600 NUMBATTLES=50 ROUNDS=35 ``` -------------------------------- ### Robocode Command Line Argument Handling Source: https://github.com/robo-code/robocode/blob/main/versions.md This section details improvements to how Robocode handles command-line arguments, particularly for specifying battle files and results. It clarifies that the '.battle' extension and 'battles/' directory can be omitted when using the `-battle` parameter. It also notes that Robocode will now exit with an error if a specified battle file does not exist. ```Java // Example of omitting .battle extension and directory // Instead of: -battle battles/sample.battle // You can now write: -battle sample // If a specified battle file does not exist, Robocode will exit with an error. ``` -------------------------------- ### Get SHA256 Checksum using Get-RemoteChecksum Source: https://github.com/robo-code/robocode/blob/main/robocode.installer/src/chocolatey/tools/VERIFICATION.txt This snippet illustrates the use of a hypothetical `Get-RemoteChecksum` function to directly obtain the checksum of a file hosted remotely. This method simplifies verification by avoiding a local download of the checksum file itself. ```powershell Get-RemoteChecksum https://sourceforge.net/projects/robocode/files/robocode/1.9.5.3/robocode-1.9.5.3-setup.jar ``` -------------------------------- ### Fix Robot ClassCastException on Type Change in Robocode Source: https://github.com/robo-code/robocode/blob/main/versions.md Resolves a ClassCastException that occurred when a robot's type was changed from Robot to AdvancedRobot and then recompiled. This fix prevents the game from crashing when starting or restarting battles with such robots. ```Java ClassCastException ``` -------------------------------- ### RoboRumble Related Competitions and Code Size Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Defines properties related to competitions for different bot sizes (MiniBots, MicroBots, NanoBots) and specifies the file used to determine robot code sizes. ```properties MINIBOTS=minirumble MICROBOTS=microrumble NANOBOTS=nanorumble CODESIZEFILE=./roborumble/files/codesize1v1.txt ``` -------------------------------- ### Set Robocode Window Visibility and Look and Feel Source: https://github.com/robo-code/robocode/blob/main/versions.md Corrected an issue where using `RobocodeEngine.setVisible(true)` resulted in the Robocode window being displayed with an incorrect size and without the native Look & Feel. The window now displays correctly. ```Java RobocodeEngine engine = new RobocodeEngine(new File("path/to/robocode")); engine.setVisible(true); ``` -------------------------------- ### Java Annotation for Safe Static Robot Reference Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces the @SafeStatic annotation in Java for suppressing warnings related to static Robot references. It requires robots to clean up static fields at the start of a new round. ```Java import robocode.annotation.SafeStatic; public class MyRobot extends AdvancedRobot { @SafeStatic private static AdvancedRobot robot; // ... robot logic ... @Override public void run() { // ... robot = this; // Assigning the current robot instance // ... } @Override public void onNewBattleTurn() { // Clean up the static field if necessary, e.g., when a new round starts if (getTurnCount() == 0) { robot = null; } } } ``` -------------------------------- ### RoboRumble Results Upload Configuration Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Specifies the URL for uploading battle results to the server and the file path for storing the number of battles fought by robots, which is returned by the server. ```properties RESULTSURL=https://literumble.appspot.com/UploadedResults BATTLESNUMFILE=./roborumble/temp/battlesnumber.txt ``` -------------------------------- ### Robocode API: Get Gun Heat Source: https://github.com/robo-code/robocode/blob/main/versions.md Provides the `getGunHeat()` method in the `Robot` class to retrieve the current gun heat. A gun heat of 0 indicates the gun is ready to fire. The gun heat increases after firing. ```Java public double getGunHeat(); // Returns the current gun heat. Fire when this is 0. ``` -------------------------------- ### RoboRumble Battle Execution Control Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/roborumble.txt Configures how battles are run, including modes like SERVER, MINI, MICRO, and NANO, which dictate robot selection based on priority and code size. It also sets the number of battles per bot for prioritization. ```properties RUNONLY=SERVER BATTLESPERBOT=2000 PRIORITYBATTLESFILE=./roborumble/temp/priority1v1.txt ``` -------------------------------- ### Get Robot Name and Version in Robocode API Source: https://github.com/robo-code/robocode/blob/main/versions.md A new method `getNameAndVersion()` has been added to the `robocode.control.RobotSpecification` interface. This method is designed to provide better support for ranking programs like RoboRumble by returning the name and version of a robot. ```Java String nameAndVersion = robotSpecification.getNameAndVersion(); ``` -------------------------------- ### Robocode: Development Options Resizable Paths Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet highlights improvements to the Development Options in Robocode. The paths list is now resizable, and buttons for adding/removing directories have been added, making the interface more user-friendly. ```Java // UI update for Development Options: // Add buttons for adding and removing directories. // Make the list of paths fully resizable. // Example UI component setup (conceptual): // JList pathList = new JList<>(paths); // JScrollPane scrollPane = new JScrollPane(pathList); // scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); // scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // JButton addButton = new JButton("Add"); // JButton removeButton = new JButton("Remove"); ``` -------------------------------- ### Configure Rating File Downloads Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/twinduel.txt Specifies the base URL for rating files and the local file names for different rumble types (general, minibots, etc.). ```properties RATINGS.URL=https://literumble.appspot.com/RatingsFile RATINGS.GENERAL=./roborumble/temp/ratings_twinduel.txt ``` -------------------------------- ### Robocode Default Battle Settings Reset Source: https://github.com/robo-code/robocode/blob/main/versions.md Corrects an issue where battle settings were not reset to default after the intro battle finished. This prevented fixed robot starting positions and the number of rounds from being reset, impacting subsequent battles. ```Java // When the intro battle has finished the battle settings are now reset to the default battle settings. // This fixes the issue were the fixed robot starting positions are still used in new battles and where the "Number // of Rounds" was set to 1 instead of 10. ``` -------------------------------- ### Robocode .NET Plugin Path Handling Source: https://github.com/robo-code/robocode/blob/main/versions.md Addresses an issue with the Robocode .NET plugin where the robocode.dll could not be found if the path contained '#' characters. This fix ensures proper handling of such paths. ```N/A Issue with the robocode.dll + # chars in the path for a dll. ``` -------------------------------- ### Robocode Bug Fix: Battle Restart and Pause Behavior Source: https://github.com/robo-code/robocode/blob/main/versions.md Addresses erratic behavior when restarting a paused battle or starting a new battle before a previous one was closed, including the 'Next Turn' button becoming unresponsive. ```Java // No specific code snippet provided, but the fix improves battle state management. ``` -------------------------------- ### Robocode API: Get Bullet Information Source: https://github.com/robo-code/robocode/blob/main/versions.md Adds the `getBullet()` method to event classes for retrieving bullet details. This allows robots to access information about the bullet involved in events like being hit, hitting another robot, or missing. ```Java public Bullet getBullet(); ``` -------------------------------- ### Write to Data Directory using RobocodeFileOutputStream (Java) Source: https://github.com/robo-code/robocode/blob/main/versions.md Demonstrates how to write data to a robot's data directory using RobocodeFileOutputStream. This method ensures that writes are confined to the designated data directory and adhere to a 100KB quota. ```Java PrintStream out1 = new PrintStream(new RobocodeFileOutputStream(getDataFile("my.dat"))); ``` -------------------------------- ### Robocode Internal Changes: PicoContainer and Maven2 Source: https://github.com/robo-code/robocode/blob/main/versions.md Details internal architectural changes in Robocode, including modularization using PicoContainer and adopting Maven2 for build setup. This improves extensibility, maintainability, and adheres to standard Maven directory structures. ```Java net.sf.robocode ``` ```Java robocode ``` -------------------------------- ### Configure Result Uploading Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/twinduel.txt Sets the URL for uploading battle results and the file path for storing the number of battles fought by each robot. ```properties RESULTSURL=https://literumble.appspot.com/UploadedResults BATTLESNUMFILE=./roborumble/temp/twinduelbattlesnumber.txt ``` -------------------------------- ### Configure Team Rumble Settings Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/roborumble/teamrumble.txt This snippet shows how to configure the TeamRumble settings by defining properties such as USER, EXCLUDE, DOWNLOAD, EXECUTE, UPLOAD, ITERATE, MELEE, TEAMS, FIELDL, FIELDH, NUMBATTLES, ROUNDS, INPUT, OUTPUT, BOTSREP, and TEMP. These properties control various aspects of the team battle process. ```properties USER=Put_Your_Name_Here EXCLUDE= DOWNLOAD=YES EXECUTE=YES UPLOAD=YES ITERATE=YES MELEE=NOT TEAMS=YES FIELDL=1200 FIELDH=1200 NUMBATTLES=10 ROUNDS=10 INPUT=./roborumble/temp/battlesTeams.txt OUTPUT=./roborumble/files/resultsTeams.txt BOTSREP=./robots/ TEMP=./roborumble/temp/ ``` -------------------------------- ### RateControlRobot: Get Turn Rate (Radians) Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet addresses a bug where the RateControlRobot incorrectly returned turn rates in radians instead of degrees for methods like getTurnRate(), getGunRotationRate(), and getRadarRotationRate(). The fix ensures these methods return values in the expected unit (degrees). ```Java /** * Returns the current turn rate of the robot in degrees. * @return the current turn rate in degrees */ public double getTurnRate() { // ... implementation returning degrees ... } /** * Returns the current gun rotation rate of the robot in degrees. * @return the current gun rotation rate in degrees */ public double getGunRotationRate() { // ... implementation returning degrees ... } /** * Returns the current radar rotation rate of the robot in degrees. * @return the current radar rotation rate in degrees */ public double getRadarRotationRate() { // ... implementation returning degrees ... } ``` -------------------------------- ### Setting JAVA_HOME Environment Variable Source: https://github.com/robo-code/robocode/blob/main/robocode.content/src/main/resources/ReadMe.md Demonstrates how to set the JAVA_HOME environment variable on Windows and Linux/macOS systems. This variable is crucial for Robocode to locate the Java Development Kit (JDK) or Java Runtime Environment (JRE). ```Windows JAVA_HOME=C:\\Program Files\\AdoptOpenJDK\\jdk-16.0.0.36-hotspot ``` ```Linux/macOS JAVA_HOME=/usr/lib/jvm/adoptopenjdk-16-hotspot-amd64 ``` -------------------------------- ### Robocode: Codesize Jar Entry Point Source: https://github.com/robo-code/robocode/blob/main/versions.md This snippet addresses an issue where the codesize-1.1.jar had an invalid entry point, causing problems with code size analysis. The fix likely involves correcting the manifest file within the JAR to specify a valid main class or entry point. ```Java // Ensure the MANIFEST.MF file within codesize-1.1.jar has a valid // Main-Class or Class-Path entry pointing to the correct entry point class. ``` -------------------------------- ### Robocode Javadocs - robocode.util and robocode.control Source: https://github.com/robo-code/robocode/blob/main/versions.md Javadoc documentation has been provided for the `robocode.util.Utils` class, which includes methods for normalizing angles, and for the `robocode.control` package, used for external control of Robocode. ```Java [Req-34]: Provide javadoc for robocode.util.Utils and robocode.control. * Javadocs have been provided for: * The robocode.util.Utils class providing angle normalizing methods. * The robocode.control package used for controlling Robocode externally. ``` -------------------------------- ### Robocode Settings and IPC Implementation Source: https://github.com/robo-code/robocode/blob/main/versions.md Highlights the redesign of RobocodeProperties to SettingsManager with ISettingsListener, and the implementation of RbSerializer for Inter-Process Communication (IPC). This lays the groundwork for multi-platform support, such as .NET. ```Java ISettingsListener ``` ```Java RbSerializer ``` -------------------------------- ### Robocode GUI Menu Shortcut Key Handling Source: https://github.com/robo-code/robocode/blob/main/versions.md Robocode now dynamically queries the Java Virtual Machine for the appropriate menu shortcut key, improving compatibility across different operating systems. macOS users, for instance, will now use the Command key instead of the Control key. ```Java // No specific code snippet provided, but the change affects GUI menu shortcut key handling. ``` -------------------------------- ### Robocode Command Line Replay Option Source: https://github.com/robo-code/robocode/blob/main/versions.md Introduces a new command-line option `-replay` for Robocode. This option enables users to replay previously recorded battles, facilitating analysis of past performances and debugging of robot strategies. ```Shell robocode.sh -replay ``` -------------------------------- ### Robocode RoboRumble Client Configuration Source: https://github.com/robo-code/robocode/blob/main/versions.md Details the addition of a new configuration file, 'roborumble.properties', for the RoboRumble client. This file allows customization of connection, read, and session timeouts for downloading robots and uploading results. ```Properties # roborumble.properties # Configure connection, read, and session timeouts for RoboRumble client # Example: # connection.timeout=10000 # read.timeout=10000 # session.timeout=10000 ``` -------------------------------- ### Robocode UI Packing: Rankings and Results Source: https://github.com/robo-code/robocode/blob/main/versions.md The Rankings Panel and Results Dialog are now automatically adjusted ('packed') to fit the content of the tables displaying rankings and results, improving their layout. ```Java // No specific code snippet provided, but the change affects UI layout behavior. ``` -------------------------------- ### Robot FileSystemManager Initialization Fix Source: https://github.com/robo-code/robocode/blob/main/versions.md Fixes a java.io.FileNotFoundException that could occur during the initialization of RobotFileSystemManager. ```Java RobotFileSystemManager.init(); // Could throw FileNotFoundException ```