Archived talk:User:CrazyBassoonist 2009/08/18

From Robowiki
Revision as of 14:26, 5 March 2009 by Nat (talk | contribs)
Jump to navigation Jump to search

Greetings

Hi, CrazyBassoonist, Welcome to the wiki! If you are fast leaner, you can learn robocode really fast! I've start robocode programming for 4 months but I've learn many of then already. Best luck for your robot, but I haven't seen your MagicD2 yet :) --Nat 10:52, 23 January 2009 (UTC)

Hey, thanks. If anyone can recommend a relatively weak robot for me to train on, that'd be awesome. I've been using N by Baal so far and right now MagicD2 only gets around 30% on average against him. -CrazyBassoonist

Well, try ad.last.bottom! If you can't beat it, you can beat nothing in rumble! I see N is at 110th position in nanorumble, you must improve your bot's performance a lot! You may try my NanoKitty, it go and stuck in wall frequently, although it's linear targeting can't hit you! But I recommend you to release robot first and see it's performance in real world. Don't care if there codesize left, you can fill it in later. (In my robot, if I have more than 15 byte spare, I'll add color :)) --Nat 09:05, 25 January 2009 (UTC)

Welcome to this wiki. I would just take a few bots that are around 500-600 ranking, and watch the battles carefully to see what is going good and wrong. Check if your bot is doing what you are expecting. My first attempt was not really successfull either (285 place out of 300) but I (slowly) worked my way up. Good luck1 --GrubbmGait 09:45, 25 January 2009 (UTC)

Thanks. That's probably a good idea. However, I can't seem to find one low in the rankings that I can download. Maybe someone could recommend an older bot for me to use? -CrazyBassoonist

I'd recommend checking the instructions to set a RoboRumble client and I think most people is using Darkcanuck's server. If you run a client it will download all bots in the rumble ;-), and you would also help the rumble. To begin you could set the options to not execute any battles, that would only make your client to download all bots.

If you want an arguably more direct approach, most bots are uploaded at http://robocoderepository.com/, you can search bots by name or some other parameters.

Also keep in mind that the same targeting/movement will have big differences against different bots, so you should train against more than one. Good luck at Robocoding. -zyx 15:58, 25 January 2009 (UTC)

Thanks, guys. I think I'll just try to pick out some robots that use a variety of movement and targeting systems and test against those.-CrazyBassoonist

If you go to the RoboRumble/Participants page on the old wiki, all the bots are listed, as well as the URL you can download them at. Be aware that many bots are designed specifically to avoid simple targeting, such as head-on, linear and circular. So until you have a 'learning' targeting there will be many bots that are specifically designed to avoid every bullet you fire. One popular technique is Stop And Go --Skilgannon 06:59, 26 January 2009 (UTC)

Thanks. I don't know much about the important stuff, but if there's any grunt work that needs to be done with the wiki I'd be glad to help with that. - CrazyBassoonist

Hey, I'd like to know, where do you come from? » Nat | Talk » 09:51, 5 March 2009 (UTC)

Well, currently I live in the U.S. but I've moved around a lot--CrazyBassoonist 12:59, 5 March 2009 (UTC)

I mean, your nationality. I'm going to request a rumble flag for you. » Nat | Talk » 13:26, 5 March 2009 (UTC)

Targeting Issue

Code problem- I am working on a little experiment with my first piece of linear targeting code before I start working on the math(and I realize that this will not work very well at all without taking other factors into consideration), and I am having a problem with coding it. When I do this, the gun swings back and forth between about where it should be to behind the enemy robot.

public void onScannedRobot(ScannedRobotEvent e){
			double robotSpeedDist = e.getVelocity()/20 
                        +(e.getDistance()/1500);
			double absoluteBearing = getHeadingRadians()
                        + e.getBearingRadians();
			double turnGun = (robocode.util.Utils.normalRelativeAngle
                       (absoluteBearing - getGunHeadingRadians()));
			if (turnGun > 0){
			setTurnGunRightRadians(((robocode.util.Utils.normalRelativeAngle
                       (absoluteBearing - getGunHeadingRadians()))+(robotSpeedDist))/2);
			}
			else{
			setTurnGunRightRadians(((robocode.util.Utils.normalRelativeAngle
                       (absoluteBearing-getGunHeadingRadians()))
                       -(robotSpeedDist))/2);
			}

Can anyone tell me what I'm doing wrong? (Sorry about the sloppy code structure, I spent a while trying to get it to look good within the wiki format then gave up.)--CrazyBassoonist 23:26, 27 January 2009 (UTC)

Well firstly, distance has no effect on linear targeting. You should shoot at the same angle regardless, check the geometry if you want, it's strange but true. Secondly, while you do consider the enemy moving in reverse (ie. e.getVelocity() can be negative) you do not consider if they are orbiting you to the left or the right. To do this you must take into consideration Lateral Velocity, ie. what the enemy's heading is, as well as their velocity. From the Linear Targeting page:

public void onScannedRobot(ScannedRobotEvent e){
    double absoluteBearing = getHeadingRadians() + e.getBearingRadians();
    double latVel = e.getVelocity() * Math.sin(e.getHeadingRadians() - absoluteBearing);
    setTurnGunRightRadians(Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians() +  latVel/11.0));
    setFire(3.0);
}

You divide by 11 because that is the velocity of a power 3 bullet (20 - 3*power, power = 3).

The reason your gun is constantly swinging back and forth (with your current code) is because you are checking which way your gun still needs to turn, and using this to decide whether to shoot in front of the bot (for a bullet intercept) or at the 'mirror location' behind it. Because every time you turned the gun the required direction to turn would change, your gun would swivel back and forth from in front to behind. Hope this helps. --Skilgannon 07:41, 28 January 2009 (UTC)

If you still want to use you old Linear Targeting code, you can use getVelocity() instead of turnGun. For the code above, you can use turnGun instead of the second and the third Utils.normalRelativeAngle(...). I think all wiki user know that Utils refer to robocode.util.Utils so you can changed that. I've clear you gun:

public void onScannedRobot(ScannedRobotEvent e){
	double robotSpeedDist = e.getVelocity()/20 + (e.getDistance()/1500);
	double absoluteBearing = getHeadingRadians() + e.getBearingRadians();
	double turnGun = Utils.normalRelativeAngle(absoluteBearing - getGunHeadingRadians());
	if (e.getVelocity() > 0) {
		setTurnGunRightRadians((turnGun + robotSpeedDist) / 2);
	} else {
		setTurnGunRightRadians((turnGun - robotSpeedDist) / 2);
	}
}

But it can't perform well without Lateral Velocity as Skilgannon explained. --Nat 09:17, 28 January 2009 (UTC)

Ah, I see what the problem was. Thanks. I think I will finally have a robot that can beat all the sample ones now.--CrazyBassoonist 16:53, 1 February 2009 (UTC)

How can you get your Linear Targeting to hit SpinBot??? I think all simple targeting can't hit all sample bot at once. --Nat 08:56, 2 February 2009 (UTC)

Hmm.. the simplest thing I can think of that might have a kinda decent hit rate on all sample bots at once, would be a velocity averaged circular targeting with a system for considering 'acceleration' of the average velocity. --Rednaxela 09:44, 2 February 2009 (UTC)

I can get a good score against Spinbot by staying close, it hits it enough just by luck.--CrazyBassoonist 12:43, 2 February 2009 (UTC)

  • Yeah, true. Just so long as you understand that staying close tends to be somewhat suicidal against most bots that keep radar locks and and fire about as often as they can :) --Rednaxela 15:37, 2 February 2009 (UTC)
  • Try to keep your distance at 50. I once saw some robot that move to distance of 50, so the bullets will hit almost of time, win large melee battle (11 bots on 800x600 battlefield) --Nat 09:33, 4 February 2009 (UTC)

Hey, Rednaxela, the averaged thing isn't easy! I took around 2 hours writing mean circular gun because I use ArrayList of heading and velocity to find average instead of simple rolling average. OK, but the description about rolling average on old wiki isn't clear enough to understand easily (at least for me, I took around 2 weeks to understand it). I think that simple pattern matching is easier than one you explain above :)

For you, CrazyBassoonist, I see you MagicD2 win your testbed! (at least N). I'd recommend you to read other people robot. That help you understand many thing in robocode. I almost understand robocode api from other robots! But, as in beginners on the old robowiki, keep you finger out of Ctrl-C and Ctrl-V buttons! --Nat 13:55, 2 February 2009 (UTC)

  • Well Nat, nah, pattern matching is definitly not easier. Let me see if I can explain the 'rolling average' in a nice simple way... What happens, if you always take the average of your current value and your old average to make a new pseudo-average that smooths towards the average. That's the most basic form of rolling average and takes no more work than "avgValue = (avgValue + newValue)/2;". However, that often doesn't smooth the value out enough, so what is usually done is add multipliers like "avgValue = (2*avgValue + newValue)/3;". That is how rolling averages work, you just need a single double to store your average and a single simple line to update it. --Rednaxela 15:37, 2 February 2009 (UTC)
  • Ha ha... That's the code description. On AntiSurfer page, it say like "In order to hit adaptive movement, you need low rolling average depth on your stats." On WaveSurfing Tutorial page, it say like "To dodge learning gun, you need to lower your rolling average depth." How your description above fit these text? Well, what I understand about rolling average is a kind of average that took only data in each frame to find average, or simplified to fit robocode theory is, a kind of average that drop old data and took only k number of past data to find average. I think the second description is what it use in robocode :) And with that description of rolling average, I can modify BasicSurfer and fit rolling average into it (which result in BlackHole). But your description is absolutely correct for those who know what it done (on old robowiki page RollingAverage said that his (Paul Evans) rolling average function will keep current list of data and drop old values that exceed its depth rate like a magic!). For newbie, it hard to understand, too. (or not, please answer me, CrazyBassoonist) --Nat 09:33, 4 February 2009 (UTC)

I don't think you need to average anything to beat the sample bots, of course it can be improved with averaged values, and while doing it very simple you don't perform so well against better bots but is a good starting point. If you implement Circular_Targeting as explained in the last paragraph of Circular_Targeting/Walkthrough you can hit very well most sample bots and should still be very easy to implement, it can hit very well SpinBot ans Walls, but of course has some problems with some of the non so predictable. But with a very bad movement it still beats them all because they fire head on, and is easy to make it fit into a nano (where pattern matching is possible, but not easy at all). It will not be so good against better movements, but I found it the simplest gun that can hit all sample bots. -zyx 21:48, 2 February 2009 (UTC)

Roborumble Questions

Just wondering.... How long does it usually take before a bot gets ranked in the roborumble?--CrazyBassoonist 17:11, 15 February 2009 (UTC)

Very short if there are clients around. I know that right now no active client is processed. I've run 300 battles just for my BlackHole for about lat 6 hours ago and there no more battles since then. If you want immediate rank, try running your own client! Make sure use use Darkcanuck server. (at first, I don't want to run client, but with interest in Ocnirp 1.0, I stand in front of my laptop for a whole night to see its ranking!) » Nat | Talk » 17:43, 15 February 2009 (UTC)

Thanks, can you tell me how long it takes before it uploads the results? And how do I make it use the Darkcanuck server?--CrazyBassoonist 18:26, 15 February 2009 (UTC)

Follow RoboRumble/Starting_With_RoboRumble page, in order to config with Darkcanuck server, replace every http://rumble.fevvir.com/rumble/ (or something like this) to http://darkcanuck.net/rumble/. After rebuild robot database and download missing bot (took ~30 minutes for me), the result will appear immediately! » Nat | Talk » 18:45, 15 February 2009 (UTC)

Okay, I'll do that. Thanks--CrazyBassoonist 18:51, 15 February 2009 (UTC)

If you want result for TBull, I think you need to put EXCLUDES=*BlackHole* in your setting for temporary, since my BlackHole has same priority as your, but my bot come first so it will battle my bots until it reach 2000 battles before start battle with your bot. Just don't forget to set EXCLUDES= whenever your bot reach 2000 battles :) » Nat | Talk » 19:07, 15 February 2009 (UTC)

Oops, I've done something wrong. What does "PARTICIPANTSURL" and "UPDATEBOTSURL" need to be set to?--CrazyBassoonist 19:09, 15 February 2009 (UTC)

No and Yes: PARTICIPANTSURL is correctly set to old wiki, but UPDATEBOTSURL is needed to be set to new server. But, I almost go to bed now (I'd 2:20 am in my country where I need to work up at 5:30 this morning) so I may don't answer you shortly » Nat | Talk » 19:21, 15 February 2009 (UTC)

Nat's AtomicMini is giving me trouble, whenever I run roborumble it ends up stuck trying to download it. Does anyone know of a way to prevent that from happening?--CrazyBassoonist 19:48, 15 February 2009 (UTC)

Which version of robocode do you use? I have this problem myself, too. But my client end up in skip it. I will reupload every of my robot to new place by this Thursday. » Nat | Talk » 19:56, 15 February 2009 (UTC)

1.62 I think. I didn't check. I am now getting a message that says "could not connect to http robocoderepository.com/Controller.jps?submitAction=downloadclass&id=(the bots id)" for every robot. :-(--CrazyBassoonist 22:28, 15 February 2009 (UTC)

I think it the rule of roborumble to use version 1.5.4 or 1.6.0. I once saw that PEZ say that 1.6.1.4 is allowed, too. You might have to change your version. » Nat | Talk » 09:42, 16 February 2009 (UTC)

1.6.1.4 is best actually. There are a number of rumble-related bugs fixed that were in 1.6.0 and older. I've tested this version extensively. However, I need to note that all version download just fine. If you're getting those errors it either means 1) robocoderepository.com is down (again...), 2) your computer can't access it for some reason OR 3) Those bots were lost at robocoderepository.com, which seems to happen a bit. Missing ones can be found in the zip files linked on RoboRumble/StartingWithRoboRumble. --Rednaxela 03:36, 17 February 2009 (UTC)

Well, actually I know that it is my fault, as it only started happening after I edited the text file to try to make it use the darkcanuck server.I successfully downloaded about half the robots, so I'm not going to run it for fear of giving wrong results.--CrazyBassoonist 04:07, 17 February 2009 (UTC)

You can edit config file to "UPLOAD=NOT" to prevent wrong results been uploaded. Actually, I think 1.6.2 has some unidentified bug. SandboxDT can't run on 1.6.2 on my machine, but 1.6.0 can. » Nat | Talk » 12:15, 17 February 2009 (UTC)


New Targeting

Well, I've been working on my targeting some, and I developed a gun that worked pretty well (by my standards). Although its not as accurate as the simpler methods, It can't be fooled in the same ways so I consider it to be much better. There's just one problem with it.... It doesn't work at all with a moving robot. Sigh. Back to the drawing board. Here's the code for it, though, I've kind of been wondering what kind of targeting this would be considered:

package oog;
import robocode.*;
public class RADGun extends AdvancedRobot{
	double oldTime=0;
	double newTime;
	double oldBearing;
	double newBearing;
	double t;
	double totalTime;
	double gunTurn;
	public void run() {
		newTime=getTime();
		turnRadarRightRadians(Double.POSITIVE_INFINITY);
	}
	public void onScannedRobot(ScannedRobotEvent e) {
		double absBearing = e.getBearingRadians()+getHeadingRadians();
		newTime=getTime();
		totalTime=newTime-oldTime;
		newBearing = absBearing;
		gunTurn=oldBearing-newBearing;
		if(e.getDistance()/13<=totalTime){
			oldBearing=absBearing;
			oldTime=getTime();
			System.out.println("gunTurn is:"+gunTurn);
		}
		setTurnGunRightRadians(robocode.util.Utils.normalRelativeAngle(absBearing-getGunHeadingRadians())-(gunTurn));
		setTurnRadarLeftRadians(getRadarTurnRemainingRadians());
		setFire(3);
		
	}
	
}

Also, I've noticed that my talk page is getting pretty crowded, should I delete some of the stuff there?--CrazyBassoonist 03:14, 19 February 2009 (UTC)

No, you shouldn't. Instead, you can categorized the comments. » Nat | Talk » 08:58, 19 February 2009 (UTC)

OK, you say your standard? Let's other people know what your standard is! Try Targeting Challenge! » Nat | Talk » 19:04, 22 February 2009 (UTC)

Ah, I think that I have found what this type of targeting is while looking on the old wiki- http://robowiki.net/cgi-bin/robowiki?AngularTargeting --CrazyBassoonist 23:11, 27 February 2009 (UTC)

Note for your code, getTime return long, changing double into log cause faster execution time (and less codesize). As the text from old wiki, this targeting cause problem on moving robot. The simple solution, yet pretty effective, is to multiply the angle by 2. » Nat | Talk » 04:45, 28 February 2009 (UTC)

I am new at programming, what kind of variable is a long?

Also, how/what would multiplying the angle by two help?--CrazyBassoonist 02:21, 1 March 2009 (UTC)

Long is 64 bits int. It can store larger number :) The number 2 help if you move perpendicular to enemy, it sometimes work. » Nat | Talk » 04:28, 1 March 2009 (UTC)

Random Robot Question

Just wondering, if randomly firing between all the angles that the enemy robot could travel to should hit all robots equally, would combining it with a movement that picks all the points it could travel to and randomly chooses one create a robot that gets a similar score against every robot?--CrazyBassoonist 17:40, 22 February 2009 (UTC)

No, it does not. Usually, GF gun will HIT those random movement much. Random gun should be OK. There some old discussion on the old wiki:

"The very good movement and random gun work better than very bad movement and super good gun."

That's all, you can only HIT most top bot by luck even with the best gun :) I think the movement type you said is name "EscapeAreaMovement" used by Lolita (a part of ancient cx.Princess). But the author, who is PEZ, said himself that this movement doesn't work well, he will go on work with all those flat movement. Of course, that's a long time ago when Wave Surfing has not yet invented. On that time, people focuses on flat movement to dodge SandboxDT. So, I supposes you to do a kind of random gun + flat movement instead :) » Nat | Talk » 18:00, 22 February 2009 (UTC)

Hmm, well I've heard that GF hits random movement well, but I don't really see why a GF gun would work better than others against random movement. Isn't GF targeting all about keeping track of what angle hits the most? If you were moving randomly, all firing angles would be equally effective--CrazyBassoonist 18:38, 22 February 2009 (UTC)

Nope, because bullets will be fired WHILE you're on the way to your destination, you're not just dealing with one at a time. Therefore you can't be totaly random to every bullet. Also, if you want to see how things are affected by randomly choosing a direction every tick, I made a nice applet that shows the movement profile as GF sees it depending on the chance of switching direction on a given tick. I could probably modify this to demonstrate the weaknesses level in "pick a random destination" movement too :) --Rednaxela 18:56, 22 February 2009 (UTC)

(Edit conflict) Yeah, that is. But if you come close enough (say 150px), you will dealing with only ONE bullet at a time! Now, do you remember the segmentation? Difference situation result in different angle. :) Note that all random function in the world use predefined formula to calculate random. The 'simple' random (like in java) doesn't spread the value enough. GF can explore this. Anyway, I'm confused why GF his random movement well, too (see my userpage!) » Nat | Talk » 19:02, 22 February 2009 (UTC)

Hmm, I see why it would now, thanks. But what if you made your robot choose the random spots based on the intervals between their shots instead of the max escape angle? You would try to be in a new random position each time one of their shots reach your distance.--CrazyBassoonist 19:07, 22 February 2009 (UTC)

Well, that still wouldn't work at close range, I just realized. But wouldn't it work if you changed the random point halfway through the firing intervals? That way they wouldn't be able to fire based on your current direction? Or maybe if you changed the random point whenever they fired--CrazyBassoonist 19:16, 22 February 2009 (UTC)

Your profile would still be non-flat because: Let's say you first choose a destination to move when bullet #1 is fired, then you choose a destination for bulet #2 after, also let's presume that bullet #1's wave passes at the same time as you reach the end destination for bullet #2. Let r1 be a random value representing your first destination, and r2 be where your second destination is relative to the first. So where you'll be when bullet #1 hits is r1+r2 correct? Well, adding two evenly distributed random numbers, results in a random result that isn't evenly distributed. No matter how evenly r1 and r2 are individually distributed, r1+r2 won't be. Let's say you roll two four-sided dice: Let's consider all possibilities:

1+1=2
1+2=3
1+3=4
1+4=5
2+1=3
2+2=4
2+3=5
2+4=6
3+1=4
3+2=5
3+3=6
3+4=7
4+1=5
4+2=6
4+3=7
4+4=8

Notice how there's only 1 possible way to get a 2, and only one possible way to get an 8, yet 4 possible ways to get a 5? This effect results in choosing a random destination for every time a bullet is fired, rather non-flat. Same principal for when you decide halfway between firing intervals, only the formula becomes 0.5*r1+r2+0.5*r3 --Rednaxela 19:24, 22 February 2009 (UTC)

Ah, that makes sense. I may be getting a little over my head here, but what if you kept a log of your past positions and used those to modify your next random position? That way instead of making your next random position a position relative to your current location, you'd try to make it a random position relative to the rest of your random positions. --CrazyBassoonist

That WOULD make you random against bullet #1, but would also mean that your reaction to bullet #1 will strongly hint about what you'll do for bullet #2, thus you'll still be vulnrable --Rednaxela 19:48, 22 February 2009 (UTC)

Maybe you could take that data and just use it do modify what you would normally do instead. That might just make you a little bit less predictable instead of non-predictable though--CrazyBassoonist 21:21, 22 February 2009 (UTC)

That would make you a bit less predictable then yes, and if I understand correctly, is exactly the kind of thing I try to optimize in the applet I link above ;) --Rednaxela 21:25, 22 February 2009 (UTC)

Ok, thanks. Cool applet by the way--CrazyBassoonist 21:43, 22 February 2009 (UTC)

Super Sample Bots

A set of all of bots that each use either a samplebot's movement or gun.

I think all sample bot use Head-On Targeting, aren't they? » Nat | Talk » 15:09, 1 March 2009 (UTC)

True, but some use it in different forms. For example, note the difference between the way MyFirstRobot and TrackFire aim. But you are right about mostly their targeting being the same, so for most of them I will only give them a different gun. I'll probably only change the movement for a couple ones--CrazyBassoonist 15:18, 1 March 2009 (UTC)