Round-robin tournament schedule: Difference between revisions
Content added Content deleted
(Added Quackery.) |
|||
Line 1,088: | Line 1,088: | ||
This seems to be related to the OEIS sequence [https://oeis.org/A036981 "A036981: (2n+1) X (2n+1) symmetric matrices each of whose rows is a permutation of 1..(2n+1)"]. The next term (for N=10) would be 444733651353600 which takes too long to check. |
This seems to be related to the OEIS sequence [https://oeis.org/A036981 "A036981: (2n+1) X (2n+1) symmetric matrices each of whose rows is a permutation of 1..(2n+1)"]. The next term (for N=10) would be 444733651353600 which takes too long to check. |
||
=={{header|Quackery}}== |
|||
<syntaxhighlight lang="Quackery"> |
|||
[ stack ] is participants ( --> s ) |
|||
[ dup 10 < if sp echo ] is recho ( n --> ) |
|||
[ dup participants share |
|||
> iff |
|||
[ drop say " bye " ] |
|||
done |
|||
say " vs " |
|||
dup echo 10 < if sp ] is lecho ( n --> ) |
|||
[ dup participants put |
|||
dup 1 & + |
|||
[] over 1 - times |
|||
[ i 1+ join ] |
|||
over 1 - times |
|||
[ say "Round " |
|||
i^ 1+ recho |
|||
say ": " |
|||
over dip |
|||
[ 2dup join ] |
|||
times |
|||
[ i i^ < iff |
|||
conclude done |
|||
dup i peek recho |
|||
dup i^ peek lecho |
|||
say " " ] |
|||
drop cr |
|||
over 2 / 1+ |
|||
split swap join ] |
|||
2drop participants release ] is schedule ( n --> ) |
|||
say "12 participants:" cr |
|||
12 schedule |
|||
cr |
|||
say "5 participants:" cr |
|||
5 schedule |
|||
cr |
|||
say "1 participant:" cr |
|||
1 schedule |
|||
cr |
|||
say "0 participants:" cr |
|||
0 schedule</syntaxhighlight> |
|||
{{out}} |
|||
<pre>12 participants: |
|||
Round 1: 1 vs 12 2 vs 11 3 vs 10 4 vs 9 5 vs 8 6 vs 7 |
|||
Round 2: 5 vs 12 6 vs 4 7 vs 3 8 vs 2 9 vs 1 10 vs 11 |
|||
Round 3: 9 vs 12 10 vs 8 11 vs 7 1 vs 6 2 vs 5 3 vs 4 |
|||
Round 4: 2 vs 12 3 vs 1 4 vs 11 5 vs 10 6 vs 9 7 vs 8 |
|||
Round 5: 6 vs 12 7 vs 5 8 vs 4 9 vs 3 10 vs 2 11 vs 1 |
|||
Round 6: 10 vs 12 11 vs 9 1 vs 8 2 vs 7 3 vs 6 4 vs 5 |
|||
Round 7: 3 vs 12 4 vs 2 5 vs 1 6 vs 11 7 vs 10 8 vs 9 |
|||
Round 8: 7 vs 12 8 vs 6 9 vs 5 10 vs 4 11 vs 3 1 vs 2 |
|||
Round 9: 11 vs 12 1 vs 10 2 vs 9 3 vs 8 4 vs 7 5 vs 6 |
|||
Round 10: 4 vs 12 5 vs 3 6 vs 2 7 vs 1 8 vs 11 9 vs 10 |
|||
Round 11: 8 vs 12 9 vs 7 10 vs 6 11 vs 5 1 vs 4 2 vs 3 |
|||
5 participants: |
|||
Round 1: 1 bye 2 vs 5 3 vs 4 |
|||
Round 2: 2 bye 3 vs 1 4 vs 5 |
|||
Round 3: 3 bye 4 vs 2 5 vs 1 |
|||
Round 4: 4 bye 5 vs 3 1 vs 2 |
|||
Round 5: 5 bye 1 vs 4 2 vs 3 |
|||
1 participant: |
|||
Round 1: 1 bye |
|||
0 participants: |
|||
</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |