Difference between revisions of "User talk:Tmservo"
Jump to navigation
Jump to search
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | package | + | <syntaxhighlight> |
+ | package Josewong; | ||
import robocode.*; | import robocode.*; | ||
//import java.awt.Color; | //import java.awt.Color; | ||
Line 6: | Line 7: | ||
/** | /** | ||
− | * | + | * Invertigo - a robot by (your name here) |
*/ | */ | ||
− | public class | + | public class Invertigo extends Robot |
{ | { | ||
/** | /** | ||
− | * run: | + | * run: Invertigo's default behavior |
*/ | */ | ||
public void run() { | public void run() { | ||
Line 24: | Line 25: | ||
while(true) { | while(true) { | ||
// Replace the next 4 lines with any behavior you would like | // Replace the next 4 lines with any behavior you would like | ||
+ | back(100); | ||
+ | turnGunLeft(360); | ||
ahead(100); | ahead(100); | ||
− | |||
− | |||
turnGunLeft(360); | turnGunLeft(360); | ||
} | } | ||
Line 36: | Line 37: | ||
public void onScannedRobot(ScannedRobotEvent e) { | public void onScannedRobot(ScannedRobotEvent e) { | ||
// Replace the next line with any behavior you would like | // Replace the next line with any behavior you would like | ||
− | fire( | + | fire(0.95); |
} | } | ||
Line 44: | Line 45: | ||
public void onHitByBullet(HitByBulletEvent e) { | public void onHitByBullet(HitByBulletEvent e) { | ||
// Replace the next line with any behavior you would like | // Replace the next line with any behavior you would like | ||
− | + | ahead(10); | |
} | } | ||
Line 52: | Line 53: | ||
public void onHitWall(HitWallEvent e) { | public void onHitWall(HitWallEvent e) { | ||
// Replace the next line with any behavior you would like | // Replace the next line with any behavior you would like | ||
− | back(20); | + | ahead(20); |
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | <syntaxhighlight> | ||
+ | package Josewong; | ||
+ | import robocode.*; | ||
+ | |||
+ | // API help : http://robocode.sourceforge.net/docs/robocode/robocode/JuniorRobot.html | ||
+ | |||
+ | /** | ||
+ | * InvertigoJunior - a robot by (your name here) | ||
+ | */ | ||
+ | public class InvertigoJunior extends JuniorRobot | ||
+ | { | ||
+ | /** | ||
+ | * run: InvertigoJunior's default behavior | ||
+ | */ | ||
+ | public void run() { | ||
+ | // Initialization of the robot should be put here | ||
+ | |||
+ | // Some color codes: blue, yellow, black, white, red, pink, brown, grey, orange... | ||
+ | // Sets these colors (robot parts): body, gun, radar, bullet, scan_arc | ||
+ | setColors(orange, blue, white, yellow, black); | ||
+ | |||
+ | // Robot main loop | ||
+ | while(true) { | ||
+ | // Replace the next 4 lines with any behavior you would like | ||
+ | back(100); | ||
+ | turnGunLeft(360); | ||
+ | ahead(100); | ||
+ | turnGunLeft(360); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * onScannedRobot: What to do when you see another robot | ||
+ | */ | ||
+ | public void onScannedRobot() { | ||
+ | // Replace the next line with any behavior you would like | ||
+ | fire(0.95); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * onHitByBullet: What to do when you're hit by a bullet | ||
+ | */ | ||
+ | public void onHitByBullet() { | ||
+ | // Replace the next line with any behavior you would like | ||
+ | ahead(10); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * onHitWall: What to do when you hit a wall | ||
+ | */ | ||
+ | public void onHitWall() { | ||
+ | // Replace the next line with any behavior you would like | ||
+ | ahead(20); | ||
} | } | ||
} | } | ||
+ | </syntaxhighlight> | ||
+ | I am actually Josewong from wikia | ||
+ | My name is Augustus Joseph Wong and my location is 7129 Beverly Street, 66204, |
Latest revision as of 02:11, 31 July 2015
package Josewong;
import robocode.*;
//import java.awt.Color;
// API help : http://robocode.sourceforge.net/docs/robocode/robocode/Robot.html
/**
* Invertigo - a robot by (your name here)
*/
public class Invertigo extends Robot
{
/**
* run: Invertigo's default behavior
*/
public void run() {
// Initialization of the robot should be put here
// After trying out your robot, try uncommenting the import at the top,
// and the next line:
// setColors(Color.red,Color.blue,Color.green); // body,gun,radar
// Robot main loop
while(true) {
// Replace the next 4 lines with any behavior you would like
back(100);
turnGunLeft(360);
ahead(100);
turnGunLeft(360);
}
}
/**
* onScannedRobot: What to do when you see another robot
*/
public void onScannedRobot(ScannedRobotEvent e) {
// Replace the next line with any behavior you would like
fire(0.95);
}
/**
* onHitByBullet: What to do when you're hit by a bullet
*/
public void onHitByBullet(HitByBulletEvent e) {
// Replace the next line with any behavior you would like
ahead(10);
}
/**
* onHitWall: What to do when you hit a wall
*/
public void onHitWall(HitWallEvent e) {
// Replace the next line with any behavior you would like
ahead(20);
}
}
package Josewong;
import robocode.*;
// API help : http://robocode.sourceforge.net/docs/robocode/robocode/JuniorRobot.html
/**
* InvertigoJunior - a robot by (your name here)
*/
public class InvertigoJunior extends JuniorRobot
{
/**
* run: InvertigoJunior's default behavior
*/
public void run() {
// Initialization of the robot should be put here
// Some color codes: blue, yellow, black, white, red, pink, brown, grey, orange...
// Sets these colors (robot parts): body, gun, radar, bullet, scan_arc
setColors(orange, blue, white, yellow, black);
// Robot main loop
while(true) {
// Replace the next 4 lines with any behavior you would like
back(100);
turnGunLeft(360);
ahead(100);
turnGunLeft(360);
}
}
/**
* onScannedRobot: What to do when you see another robot
*/
public void onScannedRobot() {
// Replace the next line with any behavior you would like
fire(0.95);
}
/**
* onHitByBullet: What to do when you're hit by a bullet
*/
public void onHitByBullet() {
// Replace the next line with any behavior you would like
ahead(10);
}
/**
* onHitWall: What to do when you hit a wall
*/
public void onHitWall() {
// Replace the next line with any behavior you would like
ahead(20);
}
}
I am actually Josewong from wikia My name is Augustus Joseph Wong and my location is 7129 Beverly Street, 66204,