- RetroGirl - Gun
It's not hard to imagine there could be movement tendencies shared by most bots, so I was pretty sure I could do better than Head-On Targeting, Linear Targeting, or Circular Targeting. Coming up with a way to decode gun logic from a bit string is the challenging part - you have to make sure the translation between bits and gun logic is one that allows crossover and mutation to retain traits, or GA wouldn't be able to evolve and improve the fitness.
I'm also interested in using it in Diamond for the first few shots, when it can outperform my KNN gun. The initial versions I tried in Diamond saw no performance increase, but I think I can do better.
How it works
The current version is basically a pre-loaded, non-learning KNN (Dynamic Clustering) gun. The attributes encoded in the bit string are:
- Weights for each dimension.
- A few hundred data points in a few dimensions, each with an associated GuessFactor.
At fire time, just look up the one nearest neighbor and shoot at the corresponding GuessFactor. For the gun in RetroGirl, I stick to attributes that don't require storing state, but for Diamond, I'm free to use things like acceleration, time since velocity change, etc. You can check RetroGirl's code for the huge hex string and the logic to decode it into a kd-tree. =)
Here are some hit rates against a test bed of ~500 bots over 4 seasons (tested with WaveSim):
- Head-On Targeting: 14.93%
- Linear Targeting: 16.05%
- Circular Targeting: 16.16%
- Best perceptual KNN gun: 17.4%
- Diamond's KNN gun: 23.21%
I've begun working with a test bed of 1-round battles, which should be more appropriate for how I want to use it in Diamond. This is a little more interesting - hit rates against ~500 bots over ~33 seasons (~16,000 battles):
- Best perceptual KNN gun so far: 21.45%
- Diamond's KNN gun: 22.02%
- Perceptual KNN for first 4 shots, then Diamond's gun: 22.69%
I expected the gap to be closer with less time for Diamond's gun to learn, but I really can't believe how highly the perceptual gun scores here. Maybe all bots move more similarly in the first round than in the rest of the battle?