logo       

Re: Perl Translation: msg#00018

lang.perl.qotw.discuss

Subject: Re: Perl Translation

On Wed, 19 Jan 2005, I wrote:

> Z(5) has +-1, +-2
> A starter is
> Inf & 4, 0 & 3, 1 & 2

> The other rounds are:
> Inf & 0, 1 & 4, 2 & 3
> Inf & 1, 2 & 0, 3 & 4
> Inf & 2, 3 & 1, 4 & 0
> Inf & 3, 4 & 2, 0 & 1

> The problem is finding the starter. I don't think any of the
> solutions to the problem so far are such a cyclic series of
> rounds.

That was a mistake. I must have been thinking about whist
tournaments (whist is a four-handed game like bridge where over
the tournament, everyone partners every one else once and opposes
every one else twice.)

Zsan Ambrus's original perl solution, for example, as expanded
below, was cyclic.

$M = $N-1;
$K = ($M-1)/2;
for $r (0 .. $M-1) {
for $t (1 .. $K) {
print( ($r+$t)%$M, "-", ($r-$t)%$M, " ")
}
print $r, "-", $M, $/
}
print$/

We are doing arithmetic modulo $N-1, the point of infinity is
arbitrarily $N-1, the starter is
1 & -1, 2 & -2, ... 0 & $N-1
and subsequent rounds follow by addition of 1 to each of the
values except the point of infinity.

So I was also wrong about it being a problem finding the starter.

Jeffrey Vinocur's visualization of the problem as n-1 teams
moving about the perimeter of n/2 parallel playing fields, ie all
except the champions who play all their games before the stadium
results in the same solution as the above one, I believe.

--
Greg Matheson, Taiwan



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise