Necesito una aplicación creada en PHP para establecer partidos de tenis por pareja.
Los partidos de tenis son de "2 personas VS 2 personas".
Necesito un algoritmo Round robin, función en el que pueda:
Ingresar el número de participantes. (mínimo 4)
Ingresar el número máximo de juegos por cada jugador.
Ingresar el número máximo de rondas.
Función PHP =>
Los participantes irán rotando para jugar todos contra todos.
Un participante no puede jugar el mismo día, se suma a la siguiente RONDA.
Un participante no puede volver a jugar con su pareja que jugó previamente.
Todos los participantes juegan el mismo número de partidos.
Los jugadores no pueden jugar el máximo de rondas establecido.
Se intentará que jueguen todos contra todos de la mejor combinación posible.
Se podrán mezclar jugadores consecutivos aleatorio.
--- el problema :
Muy sencillo cuando juegan 4 jugadores, pero ¿si juegan 13?
Entiendo que hay algoritmos que sacan mas de 500 soluciones, pero no se pueden jugar 500 veces o rondas.
He visto algoritmos que con 12 jugadores, se juegan 11 rondas y cada ronda juegan 3 partidos de 2vs2.
¿como se puede hacer este algoritmo de la mejor forma y que se puedan meter número de jugadores aleatorios y número de rondas o máximo de rondas? con mínimo de 4 claro.
Sólo necesito función PHP, ya establezco en el array los id de los jugadores.
Algunos ejemplos:
$jugadores(1,2,3,4);
return=
round 1
1,2 VS 3,4
round 2
1,3 VS 2,4
round 3
1,4 VS 2,3
----- end -------------------------
$jugadores(1,2,3,4,5,6,7,8,9,10,11,12,13);
return=
round 1
1,2 VS 3,4
5,6 VS 7,8
9,10 VS 11,12
---> 13 in home ....
---------------
round 2
13,1 VS 5,6
.... ¿?¿?¿?
return ?¿?¿?
---------------------------- English traductor ->
I need an application created in PHP to set up tennis matches per couple.
The tennis matches are "2 people vs 2 people".
I need a Round Robin algorithm, a function PHP in which I can:
Enter the number of participants. (minimum 4)
Enter the maximum number of games per player.
Enter the maximum number of rounds.
PHP function =>
The participants will rotate to play all against all.
A participant can not play on the same day, it is added to the next ROUND.
A participant can not play again with his partner who previously played.
All participants play the same number of matches.
Players can not play the maximum set rounds.
They will try to play all against all in the best possible combination.
It will be possible to mix random consecutive players.
--- the problem :
Very easy when 4 players play, but if they play 13?
I understand that there are algorithms that get more than 500 solutions, but you can not play 500 times or rounds.
I have seen algorithms that with 12 players, 11 rounds are played and each round they play 3 matches of 2vs2.
How can this algorithm be done in the best way and that can be put number of random players and number of rounds or maximum rounds? with a minimum of 4.
I just need PHP function, I already set the ID of the players in the array.
Some examples:
$ players (1,2,3,4);
return =
round 1
1.2 VS 3.4
round 2
1.3 VS 2.4
round 3
1.4 vs 2.3
----- end -------------------------
$ players (1,2,3,4,5,6,7,8,9,10,11,12,13);
return =
round 1
1.2 VS 3.4
5.6 VS 7.8
9.10 VS 11.12
---> 13 in home ....
---------------
round 2
13.1 VS 5.6
....???
return?