How to Use robocode (2) -- use eclipse to develop Robot

Source: Internet
Author: User

Part 1ArticleRobocode is briefly introduced. This article describes how to use eclipse to develop a robot.

The main steps are as follows:

1. Create a Java project in eclipse.

2. Add the robocode library to buildpath:

Right-click the project you just created and choose build path-> Add external jars. In the open Select File Dialog Box, locate the lib directory under the installation directory of robocode and select robocode. jar, such:


 

3. Create a subclass of the robot class

This action is very simple and will not be repeated.

4. Configure the execution parameters:

to enable robocode easily using eclipse, follow these steps:

right-click your project and click Run as-> RUN deployments...

Create a New Java application running configuration in the window that opens:

then you can configure specific running parameters, including:

to allocate enough memory to robocode and facilitate debugging, add the following virtual machine parameters:

-xmx512m-dsun. Io. usecanoncaches = false-ddebug = true

In addition, you must specify the working directory as the robocode installation directory:

after the above configuration, you can click Apply to save the configuration, and then click Run to run it once. Then, in the run menu, you can start robocode directly through the configuration just now, such as:

after the configuration above, although you can start robocode, you still cannot see the tanks created in your eclipse workspace during the creation of the battle. We also need to make the following settings in the robocode Program :

open options-> perferences in the main robocode window:

go to the development options tab and add the bin directory of your project to the class loading directory of robocode:

so far, when you create a battle again, you can see the tank you created in the eclipse work zone.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.