All,
One of the steps in Swiss pairing algorithm needs to create groups of players having the same score.
E.x.
P1 - 3
P2 - 3
P3 - 2
P4 - 1
P5 - 1
P6 - 1
So this should create 3 groups i.e. 3 arrays consisting Array 1: {P1, P2} ; Array 2: {P3} ; Array 3: {P4, P5, P6}.
This is dynamically changing.
In Java, we could have had an array of arraylist and make it work (One of the solutions I can think of). How can we achieve something like this in PHP?
You can do so as well in PHP with an array:
You might want to stack this into another array as well (grouped by score, probably that’s what you would think of as “arraylist in java”):
However if the value changes within any of the players group the data must be updated:
Or choose the pattern of choice to deal with the events most efficiently.