Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

a challenge/problem.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40058] a challenge/problem.
  • From: "Simon..." <devnull at linux.org>
  • Date: Tue, 18 Mar 2003 02:21:20 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I've got a puzzle, im not sure how to solve, a friend of mine asked me to
make a program that given a number of teams (which must be more than 4 but
other than that just dividable by 2) - now, there is teams\2 matches in a
round, and no team must play more than 1 match in a round (making the number
of rounds teams-1).

so if there is 10 teams, then there is 9 rounds, and 5 matches in each
round, with a total of 45 matches.

a list of combined matches could look like this

10 vs. 9
10 vs. 8
10 vs. 7
10 vs. 6
10 vs. 5
10 vs. 4
10 vs. 3
10 vs. 2
10 vs. 1
9 vs. 8
9 vs. 7
9 vs. 6
9 vs. 5
9 vs. 4
9 vs. 3
9 vs. 2
9 vs. 1
8 vs. 7
8 vs. 6
8 vs. 5
8 vs. 4
8 vs. 3
8 vs. 2
8 vs. 1
7 vs. 6
7 vs. 5
7 vs. 4
7 vs. 3
7 vs. 2
7 vs. 1
6 vs. 5
6 vs. 4
6 vs. 3
6 vs. 2
6 vs. 1
5 vs. 4
5 vs. 3
5 vs. 2
5 vs. 1
4 vs. 3
4 vs. 2
4 vs. 1
3 vs. 2
3 vs. 1
2 vs. 1

which was generated with this algorithm (which is perl if you should be
interested):

#make the ordered list of matches
 $current = $teams;  #current is now = 10
 while ($current > 1)
 {
        $next_team = $current-1;

        while ($next_team >= 1)
       {
             $matches[$counter] = "$current vs. $next_team"; #array to hold
the matches
             $counter++;
             $next_team--;
        }
        $current--;
 }


now how do i make the teams-1 rounds with 5 matches in each, where a team
does not play 2 matches.... ??

Thanks for any help !
Kindly
-Simon
ps. this message is posted to various math groups.





  • Prev by Date: Re: Summations with Primes
  • Next by Date: Re: Increase in efficiency with Module
  • Previous by thread: Re: Q: lists
  • Next by thread: RE: a challenge/problem.