Round-robin tournament schedule: Difference between revisions

Content added Content deleted
(add FreeBASIC)
m (→‎{{header|Perl}}: more general)
Line 148: Line 148:
use warnings;
use warnings;


my @teams = 1 .. 12;
my $n = 12;
for (1 .. 11)
my @teams = 1 .. $n;
for (1 .. $n-1)
{
{
@teams[0,11,1..10] = @teams;
@teams[0,$n-1,1..$n-2] = @teams;
printf 'Round %2d:' . '%4d vs %-2d'x6 . "\n", $_, @teams[map{$_,11-$_}0..5];
printf 'Round %2d:' . '%4d vs %2d'x($n/2) . "\n", $_, @teams[ map { $_, $n-1-$_} 0..($n/2)-1 ];
}</lang>
}</lang>
{{out}}
{{out}}