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)