MathGroup Archive 2009

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

Search the Archive

Re: Ten chess-players...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104809] Re: [mg104219] Ten chess-players...
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 10 Nov 2009 06:02:36 -0500 (EST)
  • References: <200910240638.CAA07417@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

I'm clearly slipping, as my previous solution fails. The one below does  
work, however.

When n is odd, you solve the problem for n + 1, and the added player is  
fictitious; being paired with the dummy means you have a "bye" in the  
round.

Clear[roundRobin, tournament]
roundRobin[n_?EvenQ][1] :=
  roundRobin[n][1] = Transpose@{Range[n/2], Range[n, n/2 + 1, -1]}
roundRobin[n_?OddQ] := roundRobin[n + 1]
roundRobin[n_?EvenQ][k_] /; k > 1 :=
  roundRobin[n][k] =
   roundRobin[n][k - 1] /.
    Thread[Range[2, n] -> RotateRight[Range[2, n]]]
tournament[n_?EvenQ] := Array[roundRobin[n], n - 1]
tournament[n_?OddQ] := tournament[n + 1]

tourney = tournament[10]

{{{1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}}, {{1, 9}, {10, 8}, {2,
    7}, {3, 6}, {4, 5}}, {{1, 8}, {9, 7}, {10, 6}, {2, 5}, {3,
    4}}, {{1, 7}, {8, 6}, {9, 5}, {10, 4}, {2, 3}}, {{1, 6}, {7,
    5}, {8, 4}, {9, 3}, {10, 2}}, {{1, 5}, {6, 4}, {7, 3}, {8, 2}, {9,
    10}}, {{1, 4}, {5, 3}, {6, 2}, {7, 10}, {8, 9}}, {{1, 3}, {4,
    2}, {5, 10}, {6, 9}, {7, 8}}, {{1, 2}, {3, 10}, {4, 9}, {5, 8}, {6,
     7}}}

Union @@ tourney == Sort@(Join @@ tourney)
Binomial[10, 2] == Total[Length /@ tourney]

True

True

tournament[9] == tournament[10]

True

The "memoization", e.g. "roundRobin[n_?EvenQ][1] := roundRobin[n][1] =  
..." isn't necessary for a tournament of reasonable size, but I put it in  
anyway. If a tournament were large enough to make it necessary, it would  
be impractical to sponsor such a round robin at all. That's why chess  
tournaments are usually scheduled via the Swiss system or even an  
"accelerated" Swiss.

Bobby

On Mon, 09 Nov 2009 21:15:12 -0600, DrMajorBob <btreat1 at austin.rr.com>  
wrote:

> Here's a simple way to compute a round robin tournament:
>
> Clear[roundRobin]
> roundRobin[n_?EvenQ][k_Integer] /; 1 <= k < n :=
>   Transpose@Partition[Flatten@{1, RotateRight[Range[2, n], k - 1]}, n/2]
> roundRobin[n_?Positive][k_Integer] := roundRobin[n + 1][k]
>
> Ten players:
>
> Array[roundRobin[10], 9]
>
> {{{1, 6}, {2, 7}, {3, 8}, {4, 9}, {5, 10}}, {{1, 5}, {10, 6}, {2,
>     7}, {3, 8}, {4, 9}}, {{1, 4}, {9, 5}, {10, 6}, {2, 7}, {3,
>     8}}, {{1, 3}, {8, 4}, {9, 5}, {10, 6}, {2, 7}}, {{1, 2}, {7,
>     3}, {8, 4}, {9, 5}, {10, 6}}, {{1, 10}, {6, 2}, {7, 3}, {8, 4}, {9,
>      5}}, {{1, 9}, {5, 10}, {6, 2}, {7, 3}, {8, 4}}, {{1, 8}, {4,
>     9}, {5, 10}, {6, 2}, {7, 3}}, {{1, 7}, {3, 8}, {4, 9}, {5, 10}, {6,
>      2}}}
>
> 9 players:
>
> Array[roundRobin[9], 8]
>
> {{{1, 6}, {2, 7}, {3, 8}, {4, 9}, {5, 10}}, {{1, 5}, {10, 6}, {2,
>     7}, {3, 8}, {4, 9}}, {{1, 4}, {9, 5}, {10, 6}, {2, 7}, {3,
>     8}}, {{1, 3}, {8, 4}, {9, 5}, {10, 6}, {2, 7}}, {{1, 2}, {7,
>     3}, {8, 4}, {9, 5}, {10, 6}}, {{1, 10}, {6, 2}, {7, 3}, {8, 4}, {9,
>      5}}, {{1, 9}, {5, 10}, {6, 2}, {7, 3}, {8, 4}}, {{1, 8}, {4,
>     9}, {5, 10}, {6, 2}, {7, 3}}}
>
> Bobby
>
> On Sat, 24 Oct 2009 01:38:47 -0500, <cmpbrn at gmail.com> wrote:
>
>> Given 10 (1 to 10) chess-players, in one day they play 5 games (1-2,
>> 6-10, 5-7, 4-8, 3-9).
>> Then they need 8 more days to complete the championship (one gamer
>> must play one time against any other player):
>> 1-3, 2-10, 6-7, 5-8, 4-9
>> 1-4, 2-3, 7-10, 6-8, 5-9
>> 1-5, 2-4, 3-10, 7-8, 6-9
>> 1-6, 2-5, 3-4, 7-9, 8-10
>> 1-7, 2-6, 3-5, 4-10, 8-9
>> 1-8, 2-7, 3-6, 4-5, 9-10
>> 1-9, 2-8, 3-7, 4-6, 5-10
>> 1-10, 2-9, 3-8, 4-7, 5-6
>>
>> How can I get the 10*(10-1)/2 = 45 pairs distributed in the 9x5
>> matrix?
>> What's about any other even number of players?
>>
>> Bruno
>>
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Plotting with dotted lines solved (Re:
  • Next by Date: Re: Re: Text on a curve
  • Previous by thread: Re: Ten chess-players...
  • Next by thread: Re: Give arrow a certain color