Archived talk:User:CrazyBassoonist 2009/08/18

From Robowiki
Revision as of 20:09, 15 February 2009 by CrazyBassoonist (talk | contribs)
Jump to navigation Jump to search

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

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)

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" need to be set to?--CrazyBassoonist 19:09, 15 February 2009 (UTC)