# How do I balance these numbers in a rock-paper-scissors attack system?

I have three arrays of numbers. If you take a random one from x, it will 'win' more times than a random number from z, which will win more times than a number from y, which will win more times than a number from x.

However, the distribution is not equal.

y beats x 51% of the time, being beaten by x 46% of the time

x beats z 46% of the time, being beaten 42% of the time

z beats y 52% of the time, being beaten 46% of the time

How can I change these to make them approximately equal, winning more than 50% of the time?

Each array must have every number from 0 to 21, add up to the same amount (currently 735) and be of equal length. The closer the probabilities are the better, the higher the better, with as few numbers as possible.

x = [21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,14,13,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,10,9,9,9,9,9,9,9,9,9,8,7,6,6,6,6,6,6,6,6,6,5,4,3,3,3,3,3,3,3,3,3,2,1,0]

y = [21,20,19,18,18,18,18,18,18,18,18,18,17,16,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

z = [21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,14,13,12,12,12,12,12,12,12,12,12,11,10,9,8,7,6,5,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,0]

• Those numbers don't add up to 100%. What happens in the remaining matches? – Philipp Nov 24 '17 at 11:18
• @Phillipp The two numbers are the same. – Piomicron Nov 24 '17 at 16:45
• @Philipp the missing % are the draws due to even-matches. – Stephane Hockenhull Nov 27 '17 at 23:45

You might want to look into the concepts behind non-transitive dice.

Briefly, it's a set of dice such that:

P(A beats B) > 50%
P(B beats C) > 50%
P(C beats A) > 50%
etc...


As an example, consider these 3 dice:

A = { 2, 2, 4, 4, 9, 9 }
B = { 1, 1, 6, 6, 8, 8 }
C = { 3, 3, 5, 5, 7, 7 }


Then:

5/9 = P(A beats B) = P(B beats C) = P(C beats A)


Not all non-transitive dice have equal probabilities like this example set does.

What matters is not the total of all the numbers but the ratio of how many numbers in one set win/lose against ALL the numbers in the other set.

To understand this you need to simplify your set to an extreme example:

A=[96, 1, 1, 1, 1] vs B=[22, 21, 20, 19, 18]

Both sets add to a total of 100.

However it's easy to see how in A vs B, A will win only 1 time out of 5.

To balance you need to compare each number on each set to each number in the other set and count the wins vs losses and adjust to insure an equal number of win/lose.

For example:

A=[96, 100, 20, 1, 1] vs B=[22, 21, 20, 19, 18]

A has a total of 218, B has a total of 100, however they will have an equal number of wins when randomly matched.

Table of where A wins with the new set:

A B:22, 21, 20, 19, 18
96   W   W   W   W   W
100  W   W   W   W   W
20   L   L   E   W   W
1    L   L   L   L   L
1    L   L   L   L   L

W=Win, E=Even, L=Lose

Wins: 12
Lose: 12
Even: 1