My first truly competitive robot, it was written for a contest at school (which I won, btw). It's a massive, multi-mode robot with just about everything you could imagine, in either working or not-quite-working form. I developed 9 movement patterns for it (one of which doesn't work), 7 aiming algorithms, 2 types of radar control (spinning for melee and tracking for 1-on-1), and 5 target-choosing algorithms (for melee, one seems to not be very effective, others do well depending on the nature of the competition). Each of the above modes is its own class, which extends one of the children of the Part class. The PartSelector
? class was written as a generic aggregation of Parts, and there are 4 subclasses of that, which are aggregations of movement strategies, target choosers, aiming algorithms, or radar controls. All in all, it gets fairly complicated, but it's really easy to expand :-) (which I like). Next goals are to make my anti-gravity work somehow, and maybe add a few more kinds of pattern matchers and a curve-flattener to counter
GuessFactorTargeting. Eventually (I've decided), it will also beat a select group of "good" robots, at which point I'll call it version 1.0.
Updates
- Won the Semi-pro league melee competition on the RobocodeOutpost?, season 1! I figured it was out of range for the really powerful robots there, but SpareParts' strength is that it is designed with melee battles (specifically battles of 4 robots, originally) and it's fairly proofed against extremely simple robots (where a lot of my smaller robots have vulnerabilities).
How does it move?
Hahaha! Well, it has 9 movement patterns:
- Anti-Gravity (which doesn't work)
- Spiraling movement (same idea as CircleBot but smoother)
- Wall movement - similar to walls but he curves the corners and doesn't normally hit the wall
- Corner movement - oscillates in the corner, inspired by DuelistNanoMelee
- Random movement - picks a pretty random direction to move, and moves that direction. The amount of time it moves in that same direction is a little less than it would take for the closest enemy to get a bullet to me firing at the last power I was hit with.
- Oscillating movement - like MyFirstRobot, but no stalling at the ends of the oscillation, and the frequency is based on the same thing as in my Random movement (so it will only jiggle if its opponent gets really close). It also attempts to stay an optimal distance from the enemy, like my Spiraling movement.
- Magnet movement - usually only used at the end of the round, it just goes straight toward the enemy to ram him.
- Complex oscillation - based on ideas from the Oscillators page (thanks to Albert), but not as fine-tuned yet as the oscillation in SillyBot.
- Bullet-dodging - attempts to detect bullets fired by enemies by monitoring their energy. It guesses that bullets fired directed straight at me, in a linear path from me (with and without velocity averaging), and in a circular path from me (with and without velocity and heading change averaging), firing, in all, 5 virtual bullets. It then tracks these bullets as "Lasers", moving about 10-15 turns ahead of the bullet and a couple turns behind it. If I am ever intersected by a "Laser", I try to move to the closest 'safe' spot. See source for more details on how it works.
How does it fire?
It selects the best of 7
virtual guns for each robot, firing a
virtual bullet just about each turn toward each robot (that's why big melee battles get really slow with this robot):
- an Iterative PatternMatching gun, based on concepts from MogBot, who was the first really good robot I ever downloaded.
- an Interative Circular-predicting gun, pretty standard, if potential wall collision is detected, it shoots a faster bullet at the point of collision.
- a gun that shoots straight at the opponent (best gun against some of the best movements)
- an arithmetic Linear-predicting gun, based on code I posted here at some point in time. Like the Circular gun, it adjusts for predicted wall collisions, which makes it often hit Walls with 3 bullets at a time in the corner.
- a Random-range gun - if all else fails, it picks a random angle to fire at from the angles that the robots could potentially move to.
- a Statistical gun, inspired by Paul Evans in SandboxDT. It probably isn't nearly as good just yet, but it's still the best gun against a lot of competitive robots. I've designed the stat-buffer to give a more even curve and (hopefully) ignore strange outliers early in its data collection.
- a short-sighted circular/linear gun - my other circular and linear gun averages velocity (and change in heading for the circular gun) over the last 10 or 20 turns, this one doesn't. My guess is that this one is the one that really ends up being used against Walls, because his sudden stops when he hits the walls can throw me off otherwise.
It moves around in 9 different patterns (well, 8, and a couple fewer, depending on the nature of the battle) to screw up
GuessFactorTargeting and
PatternMatching. One of its movements, however, is specifically designed to (semi-randomly) dodge direct, circular, and linearly aimed bullets. See the section on movement above.
How does the melee strategy differ from one-on-one strategy?
It picks a different movement pattern depending on the size of the battle. At the moment, it never picks anti-gravity, but if it did, it would likely use it primarily (maybe only) in melee. It chooses from spiral, wall, oscillating, corner, complex oscillating, or bullet dodging in Melee battles, and it chooses between spiraling, wall, oscillating, random, magnet, complex oscillating, and bullet dodging for
OneOnOne battles (or Melee battles where everyone has already been killed off except myself and one other). Eventually, I would like to be even smarter in
OneOnOne and detect if my opponent has no aiming, or if they rely heavily on circular or linear aiming. Against
HeadOnTargeting, I could use spiraling, walls, and bullet-dodging, and against linear/circular targeters, I could use oscillating, corner (which also oscillates), random, complex oscillating, and bullet-dodging techniques.
How does it select a target to attack/avoid in melee ?
Well, since nothing got left alone in this robot, it also has 5 ways of choosing a target in
Melee battles, depending on its win-loss record with each one:
- Choose the closest target (the best general-purpose method, probably)
- "Smear the Queer" - basically whenever a robot dies, the number of remaining robots (squared) is added to its "queer" score - attack the one who seems to lose alot. This is most effective to mine energy in battles with spots filled by SittingDucks.
- Vengeance - everyone someone hits me or kills me, a vengence score is added to them. Shoot at the guy who deserves to die. Works well in large battles with very few true competitors, but a lot of robots that are harder to hit than SittingDuck.
- Easiest target - look through my virtual guns and find the gun/enemy combination that has the highest predicted benefit to me - great in battles where there are enough opponents that are easy to hit, and where I can correctly identify them.
- "Kick him while he's down" - shoots at the opponent with the least energy. This doesn't seem to usually work as well.
What does it save between rounds and matches?
It stores all information about the enemies, including the stat-buffer and pattern-buffer, as static variables. It also maintains all the part-selectors, which includes experience with movement patterns, virtual guns information, etc. as static variables. Currently, it doesn't store any information to disk, although it may be beneficial to store information about which guns are more effective to use and which movement patterns get me hit less by each enemy.
Where did you get the name?
The design of the robot is modular enough that I thought of it as being built from a bunch of "parts" that I found lying around in my mind or on the Internet. Just a bag of Spare Parts all thrown together into one gigantic robot.
Can I use your code?
Go for it. Most of the part classes should be easy enough to figure out and move over to your own robots. As only a few of the parts are truly my own, I can't get mad at you for stealing them from me. I suppose if you based a robot on one of those parts, though, you could dedicate the robot or a song or something to me.
What's next for your robot?
Get the anti-gravity thing to work, make a statistical flattener (I like to call it a
SandboxFlattener), possibly add a more Aspid-style pattern matcher and a more iiley-style pattern matcher at some point.
What other robot(s) is it based on?
All of them! Among others, I got ideas from discussions on this wiki, from DuelistNanoMelee, my own CircleBot, Walls, MogBot, SandboxDT, and a lot of other worthy robots.
Question department
Wow, congrats on winning that competition! Is this bot uploaded to the
repository yet? I was trying
CurveFlattening with Marshmallow and it worked quite well, but I have now switched to using random, since it flattens the curve quite well. --
PEZ
Yes, SpareParts is available at the repository as of yesterday. I also have a version of SpareParts with sound that taunts its enemy when it wins using Mortal Kombat sound clips. The repository won't let me upload it, though, unfortunately, as it is nearly 2 MB (It was a large robot without the sounds packaged into it). I think I'll put it somewhere and link it from the repository. -- Kawigi
I can't run it on my computer though. Maybe it doesn't work on 1.3.1? I'll run it on my computer at work which has 1.4.1. It should be interesting to see it's VirtualGuns against Marshmalow?s' dittos. Where have you read about SandboxDT's statistical guns? I'd very much would like to read about it. It's amazingly effective even from the first bullets fired! You can upload the sound version on this wiki if you like. Check the Uploads page for details. -- PEZ
Paul Evans talks about how his gun basically works on his webpage, the page is linked from the wiki page for GuessFactorTargeting. My impression is that David also has a good grasp on them. As for versions of Java, I didn't know I had anything on there that required 1.4, but then again, I don't know where the geom classes fall, and I always use the 1.4 docs and JVM, whether at school, or work, or home. -- Kawigi
Get the [sound version] here