piranha wrote:If I start counting from the 0 side of the array I will end up with strange results. On the first array I will remove [2]->99 and then nothing else.
If I sort the array by the thing that is most rare I would remove 4, 5 and 6 units left but keep the rest which is probably the correct thing to do?
What I mean here is that in some situations the most common result is 1 unit left and then counting down towards 8 units, but in other situations it will be the reverse. Thats why I sorted them in the order so that I always remove the result that is most rare.
After some testing it seems to me that sorting the array and removing the lowest numbers must be the correct way to do it?
No. Don't ever sort and them remove. If you do that you could get an case like in the example I posted where a player put the dragon first following by 4 bats.
Dragon Stack Distribution: 699 576 495 364 1173 0 0 0
In that case you'd remove the 364,495 and end up saying you could get 5 units, 2 units or 1 unit left but never 3 or 4. That makes no logical sense to have gaps. This kind of occurrence will also happen if you had a stack that was something like Archon (7), Bat (1), Gryffon (6). The chance you win on the bat is quite small due to the bats strength being so low. But to say you can never win there and only on the Archon or Gryffon doesn't make much sense.
You literally start with the largest number of units left (the 8 case on both edges) and work down towards the 1 case (you never start at the 1 case and move toward the 8 case) stopping when you reach 10%. Remember we are removing the extremes at the edges, not uncommon results in the middle.
Arrange the numbers like this:
0 0 2 13 26 66 99 142 | 166 154 134 107 67 19 5 0
Because this is how they truly go. In other words the next results from 1 unit left on stack A is 1 unit left on stack B.
KGB