Robocode 2

From CompSciWiki
Revision as of 12:39, 3 April 2012 by DavidKen (Talk | contribs)

Jump to: navigation, search

COMP 1010 Home > Back to Extra Labs

Introduction

Robocode 2
Robot API
Download and Battle against the Internet

Extra Labs: Robocode, Part II

In this lab we will explore the Robot class more deeply and examine all of the different methods that the robot can call. You will become more familiar with the API for the Robot class. You will also explore the downloading of robots that others have created and testing your best creation against the world.

Installation

Building starting robot

 package robocode2;
import robocode.*;

public class Robocode2 extends Robot
{
	public void run() {
		// Robot main loop
		while(true) {
			turnGunRight(360);
		}
	}
	//onScannedRobot: What to do when you see another robot
	public void onScannedRobot(ScannedRobotEvent e) {
		fire(1);
	}	
} 


Move after being hit by a bullet

Move back after hitting a wall

Add your own event based method from the robot API

Battle!