Difference between revisions of "Merry Christmas"
Jump to navigation
Jump to search
m (merry christmas!) |
(Happy holidays!) |
||
| Line 39: | Line 39: | ||
</pre> | </pre> | ||
--[[Starrynte]] 23:52, 24 December 2008 (UTC) | --[[Starrynte]] 23:52, 24 December 2008 (UTC) | ||
| + | |||
| + | |||
| + | Happy holidays everyone! Here's a nanobot to celebrate! (Should this be on a seperate page or here?) | ||
| + | <pre> | ||
| + | package ags.holiday; | ||
| + | |||
| + | /** | ||
| + | * A simple nanobot to celebrate Dec 25, 2008! | ||
| + | * Happy holidays everybody!! | ||
| + | * | ||
| + | * -- Rednaxela | ||
| + | */ | ||
| + | |||
| + | import robocode.*; | ||
| + | import static robocode.util.Utils.normalRelativeAngle; | ||
| + | import java.awt.Color; | ||
| + | import java.util.Random; | ||
| + | // Features: infinity radar lock, headon/random targeting, random bulletpower, prime number based oscillation, random colors (Codesize: 222) | ||
| + | public class Holiday08 extends AdvancedRobot { | ||
| + | final static Color colors[] = new Color[]{Color.red, Color.green, Color.white}; | ||
| + | final static Random r = new Random(); | ||
| + | final static double HALFPI = Math.PI/2; | ||
| + | private static Color randomColor() { | ||
| + | return colors[r.nextInt(3)]; | ||
| + | } | ||
| + | |||
| + | @Override | ||
| + | public void run() { | ||
| + | setColors(randomColor(), randomColor(), randomColor(), randomColor(), randomColor()); | ||
| + | setAdjustRadarForRobotTurn(true); | ||
| + | while (true) { | ||
| + | turnRadarRightRadians(Double.POSITIVE_INFINITY); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | @Override | ||
| + | public void onScannedRobot(ScannedRobotEvent e) { | ||
| + | setBulletColor(randomColor()); | ||
| + | setTurnRadarLeftRadians(getRadarTurnRemainingRadians()); | ||
| + | setTurnGunRightRadians(normalRelativeAngle(getHeadingRadians() + e.getBearingRadians() - getGunHeadingRadians())+Math.pow(r.nextGaussian()/3,3)); | ||
| + | fireBullet(r.nextFloat()*3); | ||
| + | setAhead(200 * Math.cos((getTime()+this.getRoundNum()*17)/13) * Math.sin((getTime()+this.getRoundNum()*29)/7)); | ||
| + | setTurnRightRadians(Math.atan(e.getBearingRadians()+HALFPI)); | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | --[[User:Rednaxela|Rednaxela]] 08:13, 25 December 2008 (UTC) | ||
Revision as of 09:13, 25 December 2008
On the old wiki there was a large piece of ASCII art. The wiki is down so I'll post a not-as-good-but-still-ASCII-art (if anyone has a better one feel free to delete this one)
_______ _______ _______ _______
( )( ____ \( ____ )( ____ )|\ /|
| () () || ( \/| ( )|| ( )|( \ / )
| || || || (__ | (____)|| (____)| \ (_) /
| |(_)| || __) | __)| __) \ /
| | | || ( | (\ ( | (\ ( ) (
| ) ( || (____/\| ) \ \__| ) \ \__ | |
|/ \|(_______/|/ \__/|/ \__/ \_/
_______ _______ _________ _______ _________ _______ _______ _______
( ____ \|\ /|( ____ )\__ __/( ____ \\__ __/( )( ___ )( ____ \
| ( \/| ) ( || ( )| ) ( | ( \/ ) ( | () () || ( ) || ( \/
| | | (___) || (____)| | | | (_____ | | | || || || (___) || (_____
| | | ___ || __) | | (_____ ) | | | |(_)| || ___ |(_____ )
| | | ( ) || (\ ( | | ) | | | | | | || ( ) | ) |
| (____/\| ) ( || ) \ \_____) (___/\____) | | | | ) ( || ) ( |/\____) |
(_______/|/ \||/ \__/\_______/\_______) )_( |/ \||/ \|\_______)
_______ _ ______ _______ _______ _______
( ___ )( ( /|( __ \ |\ /|( ___ )( ____ )( ____ )|\ /|
| ( ) || \ ( || ( \ ) | ) ( || ( ) || ( )|| ( )|( \ / )
| (___) || \ | || | ) | | (___) || (___) || (____)|| (____)| \ (_) /
| ___ || (\ \) || | | | | ___ || ___ || _____)| _____) \ /
| ( ) || | \ || | ) | | ( ) || ( ) || ( | ( ) (
| ) ( || ) \ || (__/ ) | ) ( || ) ( || ) | ) | |
|/ \||/ )_)(______/ |/ \||/ \||/ |/ \_/
_ _______ _______ _______ _______
( ( /|( ____ \|\ /| |\ /|( ____ \( ___ )( ____ )
| \ ( || ( \/| ) ( | ( \ / )| ( \/| ( ) || ( )|
| \ | || (__ | | _ | | \ (_) / | (__ | (___) || (____)|
| (\ \) || __) | |( )| | \ / | __) | ___ || __)
| | \ || ( | || || | ) ( | ( | ( ) || (\ (
| ) \ || (____/\| () () | | | | (____/\| ) ( || ) \ \__
|/ )_)(_______/(_______) \_/ (_______/|/ \||/ \__/
--Starrynte 23:52, 24 December 2008 (UTC)
Happy holidays everyone! Here's a nanobot to celebrate! (Should this be on a seperate page or here?)
package ags.holiday;
/**
* A simple nanobot to celebrate Dec 25, 2008!
* Happy holidays everybody!!
*
* -- Rednaxela
*/
import robocode.*;
import static robocode.util.Utils.normalRelativeAngle;
import java.awt.Color;
import java.util.Random;
// Features: infinity radar lock, headon/random targeting, random bulletpower, prime number based oscillation, random colors (Codesize: 222)
public class Holiday08 extends AdvancedRobot {
final static Color colors[] = new Color[]{Color.red, Color.green, Color.white};
final static Random r = new Random();
final static double HALFPI = Math.PI/2;
private static Color randomColor() {
return colors[r.nextInt(3)];
}
@Override
public void run() {
setColors(randomColor(), randomColor(), randomColor(), randomColor(), randomColor());
setAdjustRadarForRobotTurn(true);
while (true) {
turnRadarRightRadians(Double.POSITIVE_INFINITY);
}
}
@Override
public void onScannedRobot(ScannedRobotEvent e) {
setBulletColor(randomColor());
setTurnRadarLeftRadians(getRadarTurnRemainingRadians());
setTurnGunRightRadians(normalRelativeAngle(getHeadingRadians() + e.getBearingRadians() - getGunHeadingRadians())+Math.pow(r.nextGaussian()/3,3));
fireBullet(r.nextFloat()*3);
setAhead(200 * Math.cos((getTime()+this.getRoundNum()*17)/13) * Math.sin((getTime()+this.getRoundNum()*29)/7));
setTurnRightRadians(Math.atan(e.getBearingRadians()+HALFPI));
}
}
--Rednaxela 08:13, 25 December 2008 (UTC)