RoboCode
Page 1 of 1 • Share •
RoboCode
I found this really neat game which incorporates java programming into it, check it out:
http://robocode.sourceforge.net/
http://robocode.sourceforge.net/help/
In essence, you create your own robot using the java programming language, then battle with it with anyone you want. We could hold competitions on the forums for fun =P
http://robocode.sourceforge.net/
http://robocode.sourceforge.net/help/
In essence, you create your own robot using the java programming language, then battle with it with anyone you want. We could hold competitions on the forums for fun =P
_________________
Highs/Median/Low of 08/09
NS: 241/226/170
CA: 100/90/80
GM: 320/270/196
SC: 132/90/50
CS: 178/152/120

Ani- Vice-President

-
Number of posts: 237
Age: 17
Location: Kanto
Registration date: 2008-05-02
Re: RoboCode
can we run private servers for a private tournament?

Michael- Graduated member

-
Number of posts: 151
Age: 18
Registration date: 2008-04-30

Re: RoboCode
Michael wrote:can we run private servers for a private tournament?
I'm not sure how, but I believe so.
In any case, we can use flashdrives to move the programs with our robots around, so that we may battle on the same computer
_________________
Highs/Median/Low of 08/09
NS: 241/226/170
CA: 100/90/80
GM: 320/270/196
SC: 132/90/50
CS: 178/152/120

Ani- Vice-President

-
Number of posts: 237
Age: 17
Location: Kanto
Registration date: 2008-05-02
Re: RoboCode
how are the bots going? mine manages to get stuck on the walls 

Michael- Graduated member

-
Number of posts: 151
Age: 18
Registration date: 2008-04-30

Re: RoboCode
Michael wrote:how are the bots going? mine manages to get stuck on the walls
Lol, my bot got deleted, but was epic fail while it lasted.
I couldnt make it target properly, so I simply made it spin around and shoot bullets.
Problem solved
Anyone else interested in making a bot?
Its actually really cool!
_________________
Highs/Median/Low of 08/09
NS: 241/226/170
CA: 100/90/80
GM: 320/270/196
SC: 132/90/50
CS: 178/152/120

Ani- Vice-President

-
Number of posts: 237
Age: 17
Location: Kanto
Registration date: 2008-05-02
Re: RoboCode
Concept seems interesting and could be just the sort of mini-time-waster I've been looking for – for which I've been looking. I'll give it a look later.

HTang- Graduated member

-
Number of posts: 44
Registration date: 2009-01-28
Re: RoboCode
HTang wrote:Concept seems interesting and could be just the sort of mini-time-waster I've been looking for – for which I've been looking. I'll give it a look later.
Lol, if any of you guys make any bots, post them here so we can check them out
_________________
Highs/Median/Low of 08/09
NS: 241/226/170
CA: 100/90/80
GM: 320/270/196
SC: 132/90/50
CS: 178/152/120

Ani- Vice-President

-
Number of posts: 237
Age: 17
Location: Kanto
Registration date: 2008-05-02
Re: RoboCode
I'm cosidering it, though I don't know if I have the programming experience
Edit:
I've got a basic robot up, and it does track.
You lose Ani!
Post your robots so we can put them in robocode!
Edit:
I've got a basic robot up, and it does track.
You lose Ani!
Post your robots so we can put them in robocode!
_________________
public class blah{
public static void main(String []args){
int i;
for (i=1; i>0;i++)
while(true)
blah();
}
}

Thunderflash- Member

-
Number of posts: 90
Age: 16
Location: Formalhaut B
Registration date: 2008-09-05
Re: RoboCode
Well here's what I have so far:
To use this robot you might need to bring the Point class into the same folder - you can find it under sampleteams-> Point.
You will need to change the package name as well.
- Code:
package rjh;
import robocode.*;
import java.awt.Color;
/**
* WallFightRobot - a robot by (Thunder)
*/
public class WallRobot extends Robot
{
double moveAmount;
public void run() {
moveAmount = Math.max(getBattleFieldWidth(), getBattleFieldHeight());
turnLeft(getHeading() % 90);
ahead(moveAmount);
turnGunRight(90);
turnRight(90);
while (true) {
ahead(moveAmount);
turnRight(90);
}
}
public void onHitRobot(HitRobotEvent e) {
if (e.getBearing() > -90 && e.getBearing() < 90) {
back(100);
}
else {
ahead(100);
}
}
public void onScannedRobot(ScannedRobotEvent e) {
if(e.getDistance()>500)
fire(2);
else
fire(3);
double enemyBearing = this.getHeading() + e.getBearing();
double enemyX = getX() + e.getDistance() * Math.sin(Math.toRadians(enemyBearing));
double enemyY = getY() + e.getDistance() * Math.cos(Math.toRadians(enemyBearing));
setGun(new Point(enemyX,enemyY));
}
public void setGun(Point p)
{
double dx = p.getX() - this.getX();
double dy = p.getY() - this.getY();
double theta = Math.toDegrees(Math.atan2(dx, dy));
turnGunRight(theta - getGunHeading());
}
}
To use this robot you might need to bring the Point class into the same folder - you can find it under sampleteams-> Point.
You will need to change the package name as well.
_________________
public class blah{
public static void main(String []args){
int i;
for (i=1; i>0;i++)
while(true)
blah();
}
}

Thunderflash- Member

-
Number of posts: 90
Age: 16
Location: Formalhaut B
Registration date: 2008-09-05
Re: RoboCode
- Code:
package testbot2;
import robocode.*;
import java.util.*;
import robocode.util.Utils;
public class TestBot extends AdvancedRobot
{
private String path;
private boolean stuck;
private double FORWARD=1.8;
public void run()
{
double FORWARD=1.8;
do
{
execute();
setTurnGunRight(360);
stuck=false;
}
while (true);
}
public void onScannedRobot(ScannedRobotEvent e)
{
int dist=(int)e.getDistance();
if(dist<400)
{
double absoluteBearing = getHeading() + e.getBearing();
double bearingFromGun = Utils.normalRelativeAngleDegrees(absoluteBearing - getGunHeading());
if (getGunHeat() == 0) {
fire((int)Math.ceil((400-dist)/50.0));
}
}
if(!stuck)
{
if (getDistanceRemaining() == 0)
{
FORWARD = -FORWARD;
setAhead(185 * FORWARD);
}
if(Math.random()<0.5)
setTurnRightRadians(e.getBearingRadians() + Math.PI/2 - 0.5236 * FORWARD * (e.getDistance() > 200 ? 1 : -1));
else
setTurnLeftRadians(e.getBearingRadians() + Math.PI/2 - 0.5236 * FORWARD * (e.getDistance() > 200 ? 1 : -1));
}
}
public void turnTo(double angle)
{
setTurnLeft(angle-getHeading());
}
public void turnGunTo(double angle)
{
setTurnGunLeft(angle-getGunHeading());
}
public void onHitWall(HitWallEvent e)
{
int mag=10;
stop();
stuck=true;
if(getX()<mag)
{
turnTo(270+((getY()<getBattleFieldHeight()/2)?-30:30));
waitFor(new TurnCompleteCondition(this));
setAhead(200);
}
else if(getX()>getBattleFieldWidth()-mag)
{
turnTo(90+((getY()<getBattleFieldHeight()/2)?-30:30));
setAhead(200);
}
else if(getY()<mag)
{
turnTo(0+((getX()<getBattleFieldWidth()/2)?-30:30));
setAhead(200);
}
else if(getY()>getBattleFieldHeight()-mag)
{
turnTo(180+((getX()<getBattleFieldWidth()/2)?-30:30));
setAhead(200);
}
}
}

Michael- Graduated member

-
Number of posts: 151
Age: 18
Registration date: 2008-04-30

Re: RoboCode
I'm too ashamed to post my robot.... =(
Maybe when I've modified it a bit
Maybe when I've modified it a bit
_________________
Highs/Median/Low of 08/09
NS: 241/226/170
CA: 100/90/80
GM: 320/270/196
SC: 132/90/50
CS: 178/152/120

Ani- Vice-President

-
Number of posts: 237
Age: 17
Location: Kanto
Registration date: 2008-05-02
Permissions of this forum:
You cannot reply to topics in this forum





