Archived talk:User:CrazyBassoonist 2009/08/18
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)
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 for 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)
- [View source↑]
- [History↑]
You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.