Dividing players
Hey, would someone help me, to do a plugin that divides users by their numbers for example, Like I've 10 players,
PHP Code:
Total NUMBER is 2850, so I'll divide them by 2, and then Part1 should be around 1425 and part2 aswell.. So part1 will be: reinert1 + reinert2 + reinert4 + reinert8 + reinert10 (total number 1450) and part2 will be: reinert3 + reinert5 + reinert6 + reinert7 + reinert9 (1400) Help help help ! |
Re: Dividing players
For best result you should sort player by points, descending.
Some like Players[33], where player[1] will be userid of player who has most points. And then use something like this: PHP Code:
|
Re: Dividing players
Could someone explain me it more detailed ? please. I still don't get it ;(
|
Re: Dividing players
1. Add all values
2. Divide by number of values Done :) May be this example would help you to understand : PHP Code:
|
Re: Dividing players
Well it's not what I need ;( Lets say I've 10 players they have the different amount of points, I would like to divide them to 2 teams (CT and T), and the CT and T team would be with equal or similar amount of points. I don't want to change their points.
I thought of sorting them in descending order, and then select every other (1, 3, 5, 7, 9 || 2, 4, 6, 8, 10). But it's not the best way of sorting players to 2 groups. Because I will get a teams like: (600+450+300+200+100 = 1650) and the other team (500+300+200+150+50 = 1200) well it's not the rightest way :( |
Re: Dividing players
So you you to balance teams levels ?
|
Re: Dividing players
Yes.
|
Re: Dividing players
There was similiar request: http://forums.alliedmods.net/showthr...41#post1250441
The idea goes like this: 1. Sort all numbers in descending order. 2. Loop through all numbers. In each iteration you add player to group that has lower total amount of points and is not full. |
Re: Dividing players
Quote:
Quote:
|
Re: Dividing players
Oh, it looks like I didn't read your post before posting and also your code will fail if in any iteration pointcount 1 and 2 become equal.
|
| All times are GMT -4. The time now is 04:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.