# Looking for a way to balance numbers for a gaming website

Page 1 of 1

## 3 Replies - 963 Views - Last Post: 06 August 2012 - 11:14 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=287944&amp;s=d80ea56507c2008d2779db84201c9047&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Mulon

Reputation: 0
• Posts: 2
• Joined: 04-August 12

# Looking for a way to balance numbers for a gaming website

Posted 04 August 2012 - 07:12 PM

Hello, I play in a gaming website where there are players with recorded numbers of game won and lost. I would like to know a program that would calculate those numbers to suggest the proper team balance. Hence putting together players with high wins with players with lower wins.
An example is this

Is This A Good Question/Topic? 0

## Replies To: Looking for a way to balance numbers for a gaming website

### #2 BBeck

• Here to help.

Reputation: 792
• Posts: 1,886
• Joined: 24-April 12

## Re: Looking for a way to balance numbers for a gaming website

Posted 05 August 2012 - 03:42 AM

I'm not 100% certain that I understand exactly what you're trying to do. But if I understand you right, I think I have a way. Maybe someone else can suggest a better algorithm. But what I would do is put them in numeric order and then start asigning them to a team off the bottom of the stack in a circle.

So this

34
32
25
21
11
8
5
4
2

Becomes team A:

2
5
11
25
34

Becomes team B:
4
8
21
32

As you can see, there are some problems with this in that team A is the obviously superior team, but this should be less true the more players you have. In other words, the more players the more balanced the teams would be.

In this case team A has the weakest players compared to team B's weakest players which are 4 and 8. But team A also has the strongest players at 25 and 34.

If you wanted to try and balance it further, you could take an average for each team at this point and compare the averages.

Team A: 77/5=15.4
Team B: 65/4=16.25

Team B has fewer players, and the top players are not as strong, but it's not carrying the weakest players either, which boosts it's average to be higher.

I don't know. That looks fairly fair to me as an average.

What if we say team B is weaker because it has a lower total score and fewer players and therefore assign the weakest player from Team A to Team B?

Becomes team A:
5
11
25
34

Becomes team B:
2
4
8
21
32

Team A: 75/4=18.75
Team B: 67/5=13.4

I don't know. Now Team B has more players and the total score of the two teams is closer together, but it actually increased the average to favor Team A because they dropped their weakest link and gave it to Team B.

So, you "could" continue to try and balance this by finding a player to take from Team A to give to Team B that would bring the averages closer together.

Becomes team A:
2
5
25
34

Becomes team B:
4
8
11
21
32

I could see by visually looking at it that 11 should do the trick.

Team A: 66/4=16.5
Team B: 76/5=15.2

I don't know. Team B actually has a lower average now. And the spread of the averages has increased. But they have more players (if that's an advantage.) I think it's a lot more fair than moving the lowest player to the other team.

Anyway, I'm not sure I'm even headed in the right direction for what you want here. I think putting them in numerical order and assigning them in a circle to each team is a good start. And maybe that's close enough for you. But if you want to make it more fair you might have to go into some deeper analysis, comparing things like the number of players assigned to each team and their average or even median strength.

### #3 Mulon

Reputation: 0
• Posts: 2
• Joined: 04-August 12

## Re: Looking for a way to balance numbers for a gaming website

Posted 05 August 2012 - 12:56 PM

Thanks for the suggestion.
In general the matches are in even numbers, like 2vs2 3vs3 and 4vs4. To make it complete the program will have to calculate odds teams (2vs3, 3vs4, 2vs6 etc...) as well.

You got it quite right tho. The only thing is that I would like the program to calculate both wins and losses for balancing. So for the screenshot I given there are 115 matches won and 162 lost. Do you think is possible to calculate both?

### #4 BBeck

• Here to help.

Reputation: 792
• Posts: 1,886
• Joined: 24-April 12

## Re: Looking for a way to balance numbers for a gaming website

Posted 06 August 2012 - 11:14 AM

Maybe you could calculate a player's rating based on wins minus losses, even allowing for a negative value. Then you could pick the players based on that score. So, 7 wins and 1 loss would be a rating of 6, where 7 wins with 23 losses would be -16.

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }