# Talk:Multiple Choice

## From old wiki's Multiple Choice page

When your targeting algorithm finds more than one angle, point or in whatever shape it yields its results, you can use a MultipleChoice algorithm to calculate the one optimal firing angle that will hit the most of those options.

I believe Albert first used this term to discribe the system used in his Aspid gun.

Bots that use MultipleChoice:

(add more if you know more)

-- Vic

I'm curious. What algorithms are there for deciding this kind of thing? This topic hasn't been discussed much, and this is one area of Fractal's new gun that could be improved. Fractal's gun while learning can yield various simultaneous graphs of the enemy's movement profile (a 'graph' being a simple curve, what you would see in any graphing bot other than Fractal 0.32), and has to make a decision on which spike to use. Currently, to perform a MultipleChoice on multiple graphs, the development version of Fractal first casts out graphs that do not have enough data to be reliably used, then simply divides the values on each graph by the total amount of data in each graph and then sums them up; that way the value of the spikes is independant of the amount of samples acquired. Then the highest spike on the summed graph is used. I've been thinking for the past couple weeks on the best way to sum this data; I'm trying to figure out a way that a hardcoded 'usefulness' factor of each graph as well as a reliability factor based on the amount of data acquired in each graph could be used to perform a better MultipleChoice than the one Fractal currently uses. I've also been trying to devise a better way to improve the algorithm that casts out graphs; I'm trying to build an algorithm to find whether a graph as enough data as a function of the deviation of the highest spike. What are everyone else's thoughts? -- Vuen

LauLectrik also used a similar approach. It had several probability distributions (ie. graphs) and had to decide which one to use. I never found a good solution, because the more graphs you have, the more likely you are to choose a bad one with a big but irrelevant spike :-(

Usually MultipleChoice is easier, because you have only one probability distributuion (ie. graph) created from the different "observations". I'm using two different methods depending on the bot, but they all need to convert the points into bearings.

- Just use a classical "data segmentation" approach, create buckets, classify your obsrvations, and pick the bucket with more observations.
- Analyze each point, count the number of points that are at less than a given distance to this point, and select the point which has more neighbours. This one has the advantage that it will not sacrifice precission, and you can use it also to analyze multi-dimensional points. On the other hand, it is more intensive in calculus, and you will need to define a distance function and a max distance (and that can be tricky if you have multi-dimensional data).

-- Albert

Let me see if I understand what this is about. If I have a classic, segmented, GuessFactorTargeting gun and I permute the possible segment combinations for a given situation. Then I use some method to choose what combination to use for this shot. Would that be a kind of MultipleChoice? If so, we can put up Marshmallow in the list above, and also the next gen GloomyDark. -- PEZ

That might deserve it's own name, like "Desegmentation" or something. -- Kawigi

Ok, so if i have an array of positions that the enemy can be in, that i then convert to an array of bearing's, how do i choose which bearing i want to use. The most obvious way to me seems to be to round off the number to some precision, then create an associative array (probably from a hashtable) and increment according to the values in the array. Then pick the highest value. Is there an easier way?? --Brainfade

Probably it is (but I think there is no need to use the hash table). Aspid just uses an array with each position meaning a bearing range (ie. 0 from -0.9 to -0.8, 1 from -0.8 to -0.7, etc.) then it puts the bearings into the array using the classical bearingToIndex function and then picks the index which has more bearings.

Another way (sued by Vibora) is to sort the bearings, then count, for each one, how many "close" bearings it has and choose the bearing with more "friends". The theorical advantage of this system is that it picks a real point, but I never found a real advantage using it.

Example: if you have {0.19, 0.20, 0.21, 0.23, 0.25} and you consider "friends" any bearing close by 0.1 then you rate your bearings like {1, 2, 1, 0, 0} so you will select 0.20 to fire at.

-- Albert

If you have an array of positions you can do it like I do in TronsGun: for each of those positions compute the angle tolerance for a bullet to hit in each case, and then count as "friends" the other angles that fall inside that interval. It's kind of a distance factored dynamic bin size. -- ABC

- [History↑]