Talk:BulletSimBot

From Robowiki
Revision as of 00:37, 6 May 2009 by Zyx (talk | contribs) (new bots are good)
Jump to navigation Jump to search

Hey guys! My bot beats DrussGT! It's weird, he just self destructs do to an error or something about a second after starting, and for the rest of the match, just appears as a crater you see after a robot blows up, not a robot. PwnBot wins instantly. PwnBot pwns him even more by making him never work again, (I had to re-download DrussGT) and best of all, I tried the trick with other bots, and it didn't work. I tried it with PwnBot again, and... PWNED! I had to re-download DrussGT again. Same thing happens with Waylander. =D

--Awesomeness 20:15, 3 May 2009 (UTC)

I bet you will see something like this in his robot console:

SYSTEM: You have skipped a turn. (x30)
SYSTEM: This robot is stopped because it doesn't perform any action in a reasonable amount of time. No score will be generated.

And that robot removed in repository, mean that you cannot create a battle with that robot again. :-) » Nat | Talk » 12:18, 4 May 2009 (UTC)

It is? Aww man... I shouldn't have killed my second copy... --Awesomeness 00:17, 5 May 2009 (UTC)

If you're putting DrussGF into melee as opposed to one-on-one this would be expected. Many one-on-one bots have code to make them outright refuse to run in melee. --Rednaxela 12:47, 4 May 2009 (UTC)

I think you mean DrussGT, do you? But why this is expected? I think it will act like every enemy is the same. » Nat | Talk » 12:57, 4 May 2009 (UTC)




Sorry if this is a bit long, but I really need to tell you this, or I'll never get any farther in Robocode.


Ugh... I found my virtual bullets simulator is totally useless for what I was planning to do with them, because I later found out that my plan was almost identical to primitive wave surfing. I can't really use them for targeting either because guess factor targeting just seems to beat everything else, and there's no uncharted ground for research. It seems to me that the one thing I made that was so important to this bot, which was going to be my first big huge statistical MegaBot, is just not good enough. It seems everything I wanted to do is just worse versions of stuff already invented. Even if there's some use for my virtual bullets and stuff I'm sure it's way too complicated for my 7th grade brain to understand. It seems like whatever I come up with is a primitive version of something now evolved into a way better version of it. So far, I've invented, and discovered it's already been done, with wave surfing, guessfactor targeting, minimum risk movement, pattern matching, and many others. Of course, then I find there's a better strategy of he same concept that's five times as good and I feel all glum. Repeat. Repeat again... Etcetera.

Anyways... I can't really do anything with PwnBot anymore, and I don't know how to get any farther ahead because I'm clueless on how to do any advanced movement or targeting. I understand exactly how they work, but never how they're implemented it. That's my problem in Java: I'm great at doing almost everything, but I can almost never do anything requiring optimization, statistics, searching, etc. It's why it's taken me over six months to have just almost finished a file compression program I've been working on, and it seems like this is why I can't do any of the complicated stuff in Robocode.

I just wish I was a genius like you guys. Sure, I'm in an advanced school. Sure, I started programming when I was eight, but I'm not a genius like you, meaning Voidious, ABC, PEZ, etcetera. How do you do it? You always know just how to do things and can come up with trig stuff in the blink of an eye, and make a robot in you're sleep that'd beat all of my robots combined. I wish I was at all like you in this. I don't know, maybe I just need practice, maybe it's just I'm too young, I don't know, but around you guys I really feel good-for-nothing here.

And I know all three of you plus more are going to say, "It didn't happen overnight!" but the thing is, I really can't catch up with you guys. I've been around for much longer than a quarter of a year, and the best bots are getting better five times as fast as I'm learning. I'm not even learning that much anymore because I simply don't understand how to do all this complicated stuff. All the tutorials explain entire classes all at once, and for me to understand a really complicated Java program, I really need it unpacked, step-by-step and not optimized for codesize so much that guessfactor targeting fits in a nano bot.

My style of coding is like this:

		VirtualBullet(double startX, double startY, double velocity, double trajectory) {
			x = startX;
			y = startY;
			speed = velocity;
			angle = trajectory;
		}
		
		public void tick(long ticks) {  //Moves the bullet the amount it would
			while(ticks > 0) {
				x += Math.sin(angle)*speed;
				y += Math.cos(angle)*speed;
				ticks --;
			}
		}
		
		//Just simple gets and sets
		public double getX() {
			return x;
		}
		
		public double getY() {
			return y;
		}
		
		//Returns distance
		public double getDistance(double botX, double botY) {
			return Math.sqrt(Math.pow(botX-x, 2)+Math.pow(botY-y, 2));
		}
		
		//If the bullet is on top of my bot, or has hit the wall, returns true
		public boolean checkCollide(double botX, double botY) {
			if (x < 0 || y < 0 || x > getBattleFieldWidth() || y > getBattleFieldHeight()) {
				return true;
			}
			if(botX-18<x && botX+18>x && botY-18<y && botY+18>y) {
				return true;
			}
			return false;
		}

Although I took a fairly simple part of the code, you can still see I comment almost everything and I space things out. I don't stuff a million things all into the same method, I just make it all clear. While all the stuff I see online is:

		double absBearing = getHeadingRadians() + e.getBearingRadians();
		double firePower = e.getDistance() < 200 ? 3 : 1.72;
		BulletWave w = new BulletWave();
		w.firedLocation = new Point2D.Double(getX(), getY());
		enemyLoc = new Point2D.Double(getX() + Math.sin(absBearing) * e.getDistance(), getY()
				+ Math.cos(absBearing) * e.getDistance());
		w.bearingDir = (e.getVelocity() * Math.sin(e.getHeadingRadians() - absBearing) < 0 ? -BIN_WIDTH
				: BIN_WIDTH);
		w.bearing = absBearing;
		w.velocity = bulletVelocity(firePower);
		int distanceIndex = (int) e.getDistance() / (MAX_DISTANCE / DISTANCE_INDEXES);
		int velocityIndex = (int) Math.abs(e.getVelocity() / 2);
		w.aimFactors = aimFactors[distanceIndex][velocityIndex];
		int mostVisited = MIDDLE_BIN;
		for (int i = 0; i < BINS; i++) {

I consider that impossible to understand. Packed together so much and no comments whatsoever. I guess I'll never learn much until I learn how to decipher stuff like this...

--Awesomeness 22:13, 5 May 2009 (UTC)


Hi Awesomeness, I haven't talked to you much yet. Just so you know, I am also new to both robocode and java, and I reached a stage similar to yours a while ago, where I felt as if I was pretty much stuck and had reached a plateau in my ability to understand things on the wiki. I realized that it was almost impossible for me to look at the code of the advanced robots and have any ideas about what the code did. For me, I found the solution in slowing down. Instead of working on other peoples ideas, I started developing a few of my own(Yes, 99.9% of the ideas I thought of had been done already). My advice to you is to check out every idea you have, even it shows little promise. Lots of times I've had random thoughts that seemed like they would get me nowhere when I first started them, but some of them ended up being new ideas that halfway work and definitely helped to advance my knowledge of robocode(and java, extremely important for me!).--CrazyBassoonist 22:56, 5 May 2009 (UTC)

P.S.- about the math, I am also not old enough to have taken trig, but I have definitely got a lot better at robot-related math since I started. You'll learn--CrazyBassoonist 22:58, 5 May 2009 (UTC)

Hey man, don't knock yourself out about stuff like that. I'm a computer science major specialized in computer graphics and artificial intelligence, have been programming for more than 13 years and been competing in programming contests for 7 years, and still took me about a year to have a decent competitive Bot. As CrazyBassoonist mentioned, slowing down is not a bad thing, I implemented the simple methods to start, while working on a decent Stop And Go you understand a lot about the Physics in Robocode, and that understanding is crucial for advanced techniques. GuessFactor Targeting and Wave Surfing aren't called advanced for nothing, but if you keep working you will get it done, don't try to go over your head though, don't try to segment it until you have it working for instance. Wave Surfing took me lots of hard working hours while going trough the tutorial and still had many bugs at the end, about the 9th version I wrote I would call bug-free (which means it probably still has some bugs :). About the trig, well it's true that you will need to master it,but look at CrazyBassoonist and Nat, they are both youngsters who have improved their trig skills while Robocoding. Just keep trying and ask questions qhen you need help. --zyx 23:33, 5 May 2009 (UTC)

Oh and I forgot, if you feel you can't work on a bot to improve it more, don't think you got to your end, the bot did, fire up your favorite IDE and start a fresh new bot ;). That usually leads to better structured code and less buggy implementations, what you learned in previous bots will carry on. --zyx 23:37, 5 May 2009 (UTC)

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.

There are no threads on this page yet.