Archived talk:User:CrazyBassoonist 2009/08/18

From Robowiki
Revision as of 17:18, 30 July 2009 by CrazyBassoonist (talk | contribs) (nano wavesurfing voodoo explained)
Jump to navigation Jump to search

For some reason I cannot access robocoderepository.com, does anyone know why that might be?--CrazyBassoonist 02:25, 19 May 2009 (UTC)

I've been having troubles since monday. is the pages not loading or a 404 thing? --HACKhalo2 02:28, 19 May 2009 (UTC)

I don't have any problem. Maybe your ISP blocked it? » Nat | Talk » 06:50, 19 May 2009 (UTC)

I'm not sure. It will load for me on one computer, but not on the one with Robocode on it.--CrazyBassoonist 12:15, 19 May 2009 (UTC)

SavantWS

Quick poll... Can I call this the first ever wavesurfing nanobot?--CrazyBassoonist 23:50, 29 July 2009 (UTC)

Some info about how it works: When the enemy fires, it logs a wave with information about when the wave will pass it and it's position, and only surfs the closest wave. It tries to move to a certain location on the wave,and it changes its destination when it gets hit. I think this is substantially different enough to be considered WaveSurfing because unlike robots like SavantVS and acesurf, SavantWS actually moves when a wave passes it in stead of changing when the enemy fires. If only it had enough space for a velocity segment, it might be really killer; as it is it has to use a duelistnano gun and it can't change direction except for on wall hits.--CrazyBassoonist 01:09, 30 July 2009 (UTC)

That being said, I would like to get opinions from other people on the wiki who know more about wavesurfing than I do before I go off and claim that this is the first wavesurfing nano, just in case my interpretation of it is wrong or it has been done this way before and I'm not aware of it.--CrazyBassoonist 01:33, 30 July 2009 (UTC)

I think it is, however it would be good if you can open sourced it so we can confirm it. » Nat | Talk » 11:06, 30 July 2009 (UTC)

Sorry again (How many sorry I need to post today? Perhaps I should stop posting 'till tomorrow), you hid your source under the source part of RobocodeRepository.com. I'm using Lynx the time I download it for first time (I'm setting some Linux server and get bored =)) and RR.com, unlike the wiki, has very bad HTML layout. I don't think it is Wave Surfing. I think I can squeeze it to 329 bytes, I'll post it if you want, but not here. I think I still call it random mover, you didn't use real GF, but a random GF. And the way you detect if is quite weird (or voodoo, in Voidious' term) » Nat | Talk » 11:30, 30 July 2009 (UTC)

Aghh, I didn't realize I hadn't packaged the code with it. Here's the code, along with a few bugfixes and debugging graphics so you can really see what it's doing:

package oog.nano.savantWS;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;

import robocode.*;
/*SavantWS- By CrazyBassoonist.
 * Graphics version.
*/
public class SavantWS3 extends AdvancedRobot {
    final static double BULLET_POWER=2.5;
    final static int ASSUMED_SPEED=14;
    final static int MAX_REACH=150;
    static double GotoPoint;
    static int dir;
    static double enemyEnergy;
    static ArrayList waves;
    public void run(){
    	dir=1;
    	waves=new ArrayList();
    	
    	turnGunRightRadians(Double.POSITIVE_INFINITY);
    }
    public void onScannedRobot(ScannedRobotEvent e){
        setTurnRightRadians(Math.cos(e.getBearingRadians()));
        if(enemyEnergy>(enemyEnergy=e.getEnergy())){
        	//The only way this was fit into a nano was by having the robot make assumptions about half of the wavesurfing.
        	//Since we aren't using bearing at all, all we do is mark our position and the time the wave will pass us.
        	wave w=new wave();
	        w.x=getX();
	        w.y=getY();
	        w.endTime=(int)(getTime()+e.getDistance()/ASSUMED_SPEED);
	        waves.add(w);
        }
        
        move();
        for(int i=0;i<waves.size();i++){
    		wave w=(wave)waves.get(i);
    		Graphics2D g=getGraphics();
    		g.setColor(Color.blue);
    		int ex=(int)(getX()+e.getDistance()*Math.sin(e.getBearingRadians()+getHeadingRadians()));
    		int ey=(int)(getY()+e.getDistance()*Math.cos(e.getBearingRadians()+getHeadingRadians()));
    		g.drawOval((int)(ex-ASSUMED_SPEED*(getTime()-w.endTime)),(int)(ey-ASSUMED_SPEED*(getTime()-w.endTime)),(int)(2*ASSUMED_SPEED*(getTime()-w.endTime)),(int)(2*ASSUMED_SPEED*(getTime()-w.endTime)));
        }
        //Gun from duelist nano, smallest radar lock/gun available(AFAIK).
        setTurnGunLeftRadians(getGunTurnRemainingRadians());
        setFire(BULLET_POWER);
    }
    //Reverse when we hit a wall.
    public void onHitWall(HitWallEvent e){
    	dir=-dir;
    }
    //Choose a new place to move to.
    public void onHitByBullet(HitByBulletEvent e){
    	GotoPoint=MAX_REACH*Math.random();
    }
    
    //Cheaper to do this here.
    public void move(){
    	int closestWave=1000000;
    	int graphNum=10000;
    	Graphics2D g=getGraphics();
    	for(int i=0;i<waves.size();i++){
    		wave w=(wave)waves.get(i);
    		//Find our closest wave, that's the only one we want to surf.
    		if(w.endTime<closestWave&&getTime()<w.endTime){
    			setAhead(dir*(Point2D.distance(getX(),getY(),w.x,w.y)-GotoPoint));
    			graphNum=i;
    			closestWave=w.endTime;
    		}
    	}
    	if(graphNum!=10000){
	    	wave GraphicsWave=(wave)waves.get(graphNum);
			g.setColor(Color.red);
			g.drawOval((int)(GraphicsWave.x-GotoPoint),(int)(GraphicsWave.y-GotoPoint),(int)GotoPoint*2,(int)GotoPoint*2);
    	}
    }
    public class wave{
    	double x;
    	double y;
    	int endTime;
    	public wave(){}
    }
}

A bit about the voodoo in this, as nat says:

  • Wave Tracking Voodoo-It does track waves. The thing is it tracks the waves using the wave's predicted hit time in lieu of normal methods.
  • GF voodoo-You are very right that it does not use GF's. Calling that variable GF was more of a joke. As you can see I have changed it in this version. What it really does is create a danger area for each wave, with the size changing based on it getting hit.
  • Surfing implementation-I think of this as more of a goto bot,as it tries to get to a certain spot on every wave.
  • Waves drawn with the graphics-I think those could reasonably be called (buggy)waves. It draws them without gathering any extra information besides the enemy's location/absolute bearing. You can really see what it's thinking a lot better with the graphics on.
  • Assumed bulletspeed-I think that this is one of the big problems for this robot. You can see how it works a lot better if you try it against a robot like ahf.Acero.

An interesting note: Almost exactly the same APS in microrumble and nanorumble. I'd be very interested in hearing what everyone has to say about this (thanks nat)--CrazyBassoonist 16:18, 30 July 2009 (UTC)

Bad Results

For some reason, the new Acraepheus was doing well then started getting zeros. Is this the result of a bug with a different version of robocode, or bad results being uploaded?--CrazyBassoonist 22:01, 19 May 2009 (UTC)

By the way, I have 1.6.2--CrazyBassoonist 22:08, 19 May 2009 (UTC)

The results I'm running show your bot doing fairly well. Perhaps it is a client issue or something. --Miked0801 22:41, 19 May 2009 (UTC)
It appears the Voidious's server is the one giving you all the 0s. Perhaps you have an exception or something that only shows up in version 1.5.4? Dunno. --Miked0801 22:44, 19 May 2009 (UTC)

You're right, thank you very much for drawing that to my attention. Does anyone know of any issues like this that occur in 1.5.4 but not in other versions?--CrazyBassoonist 22:50, 19 May 2009 (UTC)

Argh, not sure what the problem is, but killed my clients for now. I'll add you to my exclude list before I start 'em again until we figure it out. --Voidious 23:00, 19 May 2009 (UTC)

Thanks. By now I'm guessing that what I need to do is figure out what is making errors in 1.5.4 and fix it then re-upload those versions. --CrazyBassoonist 23:06, 19 May 2009 (UTC)

Sorry, I was on my way out the door before. Here's the error being hit in 1.5.4:

Acraepheus 2.2 (1): Throwable: java.lang.NoSuchMethodError: oog.Acraepheus.getGraphics()Ljava/awt/Graphics2D;
java.lang.NoSuchMethodError: oog.Acraepheus.getGraphics()Ljava/awt/Graphics2D;
    at oog.Acraepheus.onScannedRobot(Acraepheus.java:75)
    at robocode.peer.robot.EventManager.onScannedRobot(Unknown Source)
    at robocode.peer.robot.EventManager.processEvents(Unknown Source)
    at robocode.peer.RobotPeer.tick(Unknown Source)
    at robocode.peer.RobotPeer.turnRadar(Unknown Source)
    at robocode._AdvancedRadiansRobot.turnRadarRightRadians(Unknown Source)
    at oog.Acraepheus.run(Acraepheus.java:71)
    at robocode.peer.RobotPeer.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:619)

I don't mind updating my clients, but unfortunately, there's no guarantee someone else won't run 1.5.4 as long as it's still allowed...

--Voidious 23:52, 19 May 2009 (UTC)

And I believe that error would happen in 1.6.0 too, I had the same problem once, since then I always get the Graphics2D object out of the onPaint method only. --zyx 01:03, 20 May 2009 (UTC)

Well it looks like it's just a problem with the debugging graphics. Line 75 is this:

Graphics 2D g=getGraphics();

Shouldn't hurt that much to remove it, I probably should have left the debugging graphics out anyway.--CrazyBassoonist 00:32, 20 May 2009 (UTC)

I've now got it fixed, thanks for the help. How long does it take the rumble to remove robots that have been removed from the participants list? Even some of my very old robots seem to be there still--CrazyBassoonist 01:08, 20 May 2009 (UTC)

It's not a static delay, as far as I know it's just that it only allows removals from Darkcanuck's clients. That's usually within a day or so, in my experience. No need to wait on posting your new versions, though, at least if you ask me. =) --Voidious 01:17, 20 May 2009 (UTC)

Thanks, I was more concerned about the old versions being gigantic problembots for others due to the zeros. Is it normal to see scores that you can't replicate in tests? I've tried my robot against barracuda 1.0 about 20 times by now, and the lowest score I've recorded so far has been 42%. How could it have ended up with 32% against it in the roborumble?--CrazyBassoonist 01:42, 20 May 2009 (UTC)

Nope, and I also get incredibly frustrated when I see battle results that I can't duplicate locally. But there can be a surprising amount of variance in Robocode battles. --Voidious 01:49, 20 May 2009 (UTC)

Behold, the demon known as Standard Deviation - bane of all robocoders looking for consistant results :) --01:57, 20 May 2009 (UTC)

But wait a second.... I realize that that's within the realm of probability, but what about the 10% against pkkillers.PKassassin? I average around 50% on him in my own tests.... And acraepheus hasn't been doing too well against duelistMicro, but 3% is really pushing it=( Anyway, standard deviance or not, I must sleep now so I'll try to see what it is tomorrow--CrazyBassoonist 02:06, 20 May 2009 (UTC)

In both cases, the other bot only has a couple hundred bullet damage (way cool we can see that on Darkcanuck's server), which leads me to believe your bot must have errored out somehow... --Voidious 02:10, 20 May 2009 (UTC)


Okay... I downloaded 1.6.1.4, and I'm not getting any errors so far--CrazyBassoonist 21:01, 20 May 2009 (UTC)

Changes checking

I'm curious, how can you answer things so fast? I actually checking the recent changes every 10 minutes. But when I'm working, I may left it for hours without checking. Are you using RSS/Atom client which refresh every minute? » Nat | Talk » 13:51, 27 May 2009 (UTC)

Theres no secret to it, Its just that I often find myself checking the wiki while developing robots. There's not much to do when waiting for a thousand round melee battle to finish--CrazyBassoonist 13:55, 27 May 2009 (UTC)