[Home]TheBrainPi

Robo Home | Changes | Preferences | AllPages

I just got a little mad and created this monster. It uses a NN for targeting (just because it's what I'm interested in right now) and goes against all Robocode best practices and accepted principles ... Try it at your own risk.

What's special about it?

It uses a big brain, implemented trough a big NN. Instead of learning how to target the enemies one by one (and storing data for all of them) it learns to target them all as a whole (in fact, it assumes that ALL bots have commonalities in their movement, so learning how to target one should be good to target the next one).

Also it factors TheBrainPi movement into the targeting system (ie. its brain).

Great, I want to try it. Where can I download it?

You can download it from the RobocodeRepository.

How competitive is it?

It's a little bit erratic. If you give it some time to readapt it's brain, its quite effective (in fact, it beats many good bots, but deppends on who fought in the previous battles, the brain mod, and some unknown factors).

I haven't tested it so much.

How does it move?

Just random movement. I added some of Kawigi's code for DynamicDistancing, but I think that in the released version has no effect at all (or may be it has?). Anyway, thanks Kawigi: I discovered the power of DynamicDistance when your Flood's were beating my nanoLauLectik? with just head on targeting.

How does it fire?

It uses its brain to predict the enemy position. Note that it's a real brain. I just feed it with TheBrainPi and the enemy position (and some history) and it predicts the future enemy position. But it's just its brain who does it, so no idea how it aims.

How does it dodge bullets?

No bullet dodging. Just RandomMovement, very similar to Aspid, but with some DynamicDistancing added.

How does the melee strategy differ from one-on-one strategy?

It's a pure 1v1 bot.

How does it select a target to attack/avoid in melee?

It's a pure 1v1 bot.

What does it save between rounds and matches?

It saves its brain, and some randomly choosen input/output patterns from previous matches, to avoid over-specialization during the first rounds.

Where did you get the name?

There was a movie called PI, where a guy was trying to discover the formula that rules the markets... He gets mad as the movie goes on. TheBrainPi is also the result of madness.

Can I use your code?

Of course. If you use a signifcative portion of it, please make your bot open source.

What's next for your robot?

Test this crazy idea and see if it has some future.

Does it have any WhiteWhales?

No idea. I have not tested it (almost).

What other robot(s) is it based on?

The original code was from ScruchiPu. Also includes some code from Kawigi's FloodMini.


Comments, questions, feedback:

Thrilling new NN project! But it bugs out on my computer. Null pointer exception when it is initializing the net I think... Is it because I'm on Java 1.3.1 you think? -- PEZ

I don't think it's because of Java 1.3. I'm not concious there is any java 1.4 specific call (and if there is, I can fix it). Could you post the error so I can check it? -- Albert

OK, good to hear it's not yet another 1.4 specific bot. I'll post the stack trace as soon as the current league I'm running is finished. All these pattern matchers take forever to run on nmy ageing laptop. -- PEZ

Here's the error message and stack trace. Good news is that it only happens in the first round and then the brain fights, and fights well! Impressing.

apv.TheBrainPi 0.5: Exception: java.lang.NullPointerException
java.lang.NullPointerException
    at apv.TheBrainPi.buildOutput(TheBrainPi.java:231)
    at apv.TheBrainPi.learn(TheBrainPi.java:177)
    at apv.TheBrainPi.onScannedRobot(TheBrainPi.java:143)
-- PEZ

Just for reference I do not get that under Java 1.4.1 using the Sun JVM. Though I have a hard time seeing how you could have a null pointer be machine-specific, unless your VM doesn't initialize something the way a newer one does.. *puzzled*

You do, however, have an array which fills up at around round 250.

apv.TheBrainPi 0.5: Exception: java.lang.ArrayIndexOutOfBoundsException: 100002
java.lang.ArrayIndexOutOfBoundsException: 100002
    at apv.TheBrainPi.aim(TheBrainPi.java:195)
    at apv.TheBrainPi.onScannedRobot(TheBrainPi.java:145)
    at robocode.peer.robot.EventManager.onScannedRobot(EventManager.java:607)
    at robocode.peer.robot.EventManager.processEvents(EventManager.java:738)
    at robocode.peer.RobotPeer.tick(RobotPeer.java:1024)
    at robocode.AdvancedRobot.execute(AdvancedRobot.java:186)
    at apv.TheBrainPi.run(TheBrainPi.java:118)
    at robocode.peer.RobotPeer.run(RobotPeer.java:616)
    at java.lang.Thread.run(Thread.java:536)

Since TheBrainPi isn't codesize restricted, I'd recommend changing the array to a more dynamic storage class, like a [Vector], which can continually expand. If whatever data that array holds gets old you could simply also throw it out, which is again much easier to do in a [Vector]. -- Kuuran

Good idea. I'w do as soon as possible. -- Albert

But don't use a Vector, it's an old reminesant from Java 1.1 or some such. An ArrayList is probably a better choice. -- PEZ

I thought they were redesigned in 1.2? I might be mistaken.. -- Kuuran

A Vector is a thread safe implementation of an ArrayList. If you are not multi-threaded or if you are willing to worry about synchronization on your own, they are interchangeable. There used to be a significant performance hit for the synchronization in a Vector but that is not so much the case any more. -- jim


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 18, 2006 21:41 EST by Florent (diff)
Search: