Re: [QUIZ] Perl 'Medium' QOTW - Tournament Schedule
Jim Martinez <[email protected]> Fri, 14 Jan 2005 15:37:59 -0500 (EST)
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <Pine.LNX.4.44.0501141531490.20892-100000@xwing.e-techservices.com> |
On Jan 14 David Jones wrote:
> > Each day allocation will be a reference to an array
> > that for each index will specify the index of the team
> > that the team with the index in that array
> > will compete against that day.
>
> Sorry, I just can't parse that sentence.
>
> Clarification, anyone?
allocate_schedule(4)
may return:
[[1,0,3,2],[2,3,0,1],[3,2,1,0]];
For Day one the array is [1,0,3,2].
Team 0 looks at the first entry to see who they play. The first entry in
[1,0,3,2] is a 1, so they play team 1.
Team 1 looks at the second entry to see who they play. The second entry
in [1,0,3,2] is a 0, so they play team 0.
Team 2 looks at the third entry to see who they play. The third entry in
[1,0,3,2] is a 3, so they play team 3.
Team 3 looks at the last entry to see who they play. The last entry in
[1,0,3,2] is a 2, so they play team 2.
For Day two the array is [2,3,0,1] ...
Team 0 and 2 play each other.
Team 1 and 3 play each other.
HTH,
Jim