Ten players and I need to draw player pairs for two rounds. This works fine but problem is that there could be same match in first and second round. Ie:
8 - 10
2 - 5
4 - 3
9 - 7 !!
6 - 1
2 - 4
5 - 10
8 - 1
3 - 6
7 - 9 !!
As you see there's same match twice 9 vs. 7 and 7 vs. 9. That is what I should prevent. Same players should'nt face each other in first two rounds. How to prevent it? This code creates draw:
$lkm = 10;
//-------------- first round:
$eka = range(1, $lkm);
shuffle($eka);
for ($key = 0; $key <= $lkm/2-1; $key++) {
echo $eka[$key] . " - " . $eka[$lkm/2+$key] . "<br>";
}
//-------------- second round:
echo "<br>";
$toka = range(1, $lkm);
shuffle($toka);
for ($key = 0; $key <= $lkm/2-1; $key++) {
echo $toka[$key] . " - " . $toka[$lkm/2+$key] . "<br>";
}