-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsingle_elimination.html
6513 lines (6484 loc) · 338 KB
/
single_elimination.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.5.57">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>single_elimination</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="single_elimination_files/libs/clipboard/clipboard.min.js"></script>
<script src="single_elimination_files/libs/quarto-html/quarto.js"></script>
<script src="single_elimination_files/libs/quarto-html/popper.min.js"></script>
<script src="single_elimination_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="single_elimination_files/libs/quarto-html/anchor.min.js"></script>
<link href="single_elimination_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="single_elimination_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="single_elimination_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="single_elimination_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="single_elimination_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
</head>
<body class="fullcontent">
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">single_elimination</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'tidyverse' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'ggplot2' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'tibble' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'tidyr' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'readr' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'dplyr' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: package 'forcats' was built under R version 4.2.3</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.5.0 ✔ tibble 3.2.1
✔ lubridate 1.9.2 ✔ tidyr 1.3.1
✔ purrr 1.0.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors</code></pre>
</div>
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(dplyr)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<section id="simulate-a-single-match" class="level1">
<h1>Simulate a Single Match</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Function to simulate a match using Bradley-Terry model</span></span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a>simulate_match <span class="ot"><-</span> <span class="cf">function</span>(team1, team2, strength1, strength2) {</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> p <span class="ot"><-</span> <span class="fu">exp</span>(strength1 <span class="sc">-</span> strength2)<span class="sc">/</span>(<span class="dv">1</span><span class="sc">+</span><span class="fu">exp</span>(strength1 <span class="sc">-</span> strength2))</span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a> winner <span class="ot"><-</span> <span class="fu">ifelse</span>(<span class="fu">runif</span>(<span class="dv">1</span>) <span class="sc"><</span> p, team1, team2) <span class="co"># Randomize outcom</span></span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(winner)</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="single-elimination-tournament-structures" class="level1">
<h1>Single Elimination Tournament Structures</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>num_teams <span class="ot"><-</span> <span class="dv">8</span></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>teams <span class="ot"><-</span> <span class="fu">paste</span>(<span class="st">"Team"</span>,num_teams<span class="sc">:</span><span class="dv">1</span>)</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a>team_map <span class="ot"><-</span> <span class="fu">setNames</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">8</span>, teams)</span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a>tourn <span class="ot"><-</span> <span class="fu">do.call</span>(rbind, <span class="at">args =</span> combinat<span class="sc">::</span><span class="fu">permn</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">8</span>))</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a>dist <span class="ot"><-</span> <span class="fu">apply</span>(<span class="at">X =</span> tourn, <span class="at">MARGIN =</span> <span class="dv">1</span>, <span class="at">FUN =</span> <span class="cf">function</span>(x){</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">sum</span>(x[<span class="dv">5</span><span class="sc">:</span><span class="dv">8</span>] <span class="sc">==</span> <span class="dv">1</span>) <span class="sc">></span> <span class="dv">0</span>) {</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a> x[<span class="dv">1</span><span class="sc">:</span><span class="dv">8</span>] <span class="ot"><-</span> x[<span class="fu">c</span>(<span class="dv">5</span><span class="sc">:</span><span class="dv">8</span>, <span class="dv">1</span><span class="sc">:</span><span class="dv">4</span>)]</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">sum</span>(x[<span class="dv">3</span><span class="sc">:</span><span class="dv">4</span>] <span class="sc">==</span> <span class="fu">min</span>(x[<span class="dv">1</span><span class="sc">:</span><span class="dv">4</span>])) <span class="sc">></span> <span class="dv">0</span>) {</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a> x[<span class="dv">1</span><span class="sc">:</span><span class="dv">4</span>] <span class="ot"><-</span> x[<span class="fu">c</span>(<span class="dv">3</span><span class="sc">:</span><span class="dv">4</span>, <span class="dv">1</span><span class="sc">:</span><span class="dv">2</span>)]</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">sum</span>(x[<span class="dv">7</span><span class="sc">:</span><span class="dv">8</span>] <span class="sc">==</span> <span class="fu">min</span>(x[<span class="dv">5</span><span class="sc">:</span><span class="dv">8</span>])) <span class="sc">></span> <span class="dv">0</span>) {</span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a> x[<span class="dv">5</span><span class="sc">:</span><span class="dv">8</span>] <span class="ot"><-</span> x[<span class="fu">c</span>(<span class="dv">7</span><span class="sc">:</span><span class="dv">8</span>, <span class="dv">5</span><span class="sc">:</span><span class="dv">6</span>)]</span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> (i <span class="cf">in</span> <span class="fu">c</span>(<span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">7</span>)) {</span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a> x[i<span class="sc">:</span>(i <span class="sc">+</span> <span class="dv">1</span>)] <span class="ot"><-</span> <span class="fu">sort</span>(x[i<span class="sc">:</span>(i <span class="sc">+</span> <span class="dv">1</span>)])</span>
<span id="cb12-17"><a href="#cb12-17" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a><span class="fu">return</span>(x)</span>
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a>})</span>
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb12-21"><a href="#cb12-21" aria-hidden="true" tabindex="-1"></a>dist <span class="ot"><-</span> <span class="fu">t</span>(dist)</span>
<span id="cb12-22"><a href="#cb12-22" aria-hidden="true" tabindex="-1"></a>seeding_structure <span class="ot"><-</span> dist[<span class="sc">!</span><span class="fu">duplicated</span>(dist), ]</span>
<span id="cb12-23"><a href="#cb12-23" aria-hidden="true" tabindex="-1"></a>seeding_structure_char <span class="ot"><-</span> <span class="fu">apply</span>(seeding_structure,<span class="dv">1</span>,<span class="cf">function</span>(x) {<span class="fu">paste0</span>(x,<span class="at">collapse=</span><span class="st">""</span>)})</span>
<span id="cb12-24"><a href="#cb12-24" aria-hidden="true" tabindex="-1"></a><span class="co"># How to check for a specific seed</span></span>
<span id="cb12-25"><a href="#cb12-25" aria-hidden="true" tabindex="-1"></a><span class="fu">which</span>(<span class="fu">apply</span>(seeding_structure, <span class="dv">1</span>, <span class="cf">function</span>(x) <span class="fu">all</span>(x <span class="sc">==</span> <span class="fu">c</span>(<span class="dv">1</span>, <span class="dv">8</span>, <span class="dv">4</span>, <span class="dv">5</span>, <span class="dv">2</span>, <span class="dv">7</span>, <span class="dv">3</span>, <span class="dv">6</span>))))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 187</code></pre>
</div>
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="do">## Important Structures Rows ##</span></span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a><span class="co"># 1-8: row 1</span></span>
<span id="cb14-3"><a href="#cb14-3" aria-hidden="true" tabindex="-1"></a><span class="co"># (1,8), (2,7), (3,6), (4,5): row 23</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="setting-up-the-teams-and-strengths" class="level1">
<h1>Setting Up the Teams and Strengths</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Assign random strengths to each team coming from normal and uniform distributions</span></span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a>normal_strengths <span class="ot"><-</span> <span class="fu">data.frame</span>(</span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a> <span class="at">Team =</span> teams,</span>
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a> <span class="at">Strength =</span> <span class="fu">sapply</span>(num_teams, <span class="cf">function</span>(n) { <span class="fu">qnorm</span>(<span class="dv">1</span><span class="sc">:</span>n<span class="sc">/</span>(n<span class="sc">+</span><span class="dv">1</span>)) }),</span>
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a> <span class="at">Wins =</span> <span class="fu">rep</span>(<span class="dv">0</span>,num_teams),</span>
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a> <span class="at">Ranks =</span> <span class="fu">rep</span>(<span class="cn">NA</span>,num_teams)</span>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a>normal_strengths<span class="sc">$</span>True_Rank <span class="ot"><-</span> <span class="fu">rank</span>(<span class="sc">-</span>normal_strengths<span class="sc">$</span>Strength, <span class="at">ties.method =</span> <span class="st">"average"</span>)</span>
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a>normal_strengths <span class="ot"><-</span> <span class="fu">arrange</span>(normal_strengths, True_Rank)</span>
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a>unif_strength <span class="ot"><-</span> <span class="fu">data.frame</span>(</span>
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a> <span class="at">Team =</span> teams,</span>
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a> <span class="at">Strength =</span> <span class="fu">sapply</span>(num_teams, <span class="cf">function</span>(n) { <span class="fu">qunif</span>(<span class="dv">1</span><span class="sc">:</span>n<span class="sc">/</span>(n<span class="sc">+</span><span class="dv">1</span>) , <span class="dv">0</span> , <span class="fu">sqrt</span>(<span class="dv">12</span>)) }),</span>
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a> <span class="at">Wins =</span> <span class="fu">rep</span>(<span class="dv">0</span>,num_teams),</span>
<span id="cb15-15"><a href="#cb15-15" aria-hidden="true" tabindex="-1"></a> <span class="at">Ranks =</span> <span class="fu">rep</span>(<span class="cn">NA</span>,num_teams)</span>
<span id="cb15-16"><a href="#cb15-16" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb15-17"><a href="#cb15-17" aria-hidden="true" tabindex="-1"></a>unif_strength<span class="sc">$</span>True_Rank <span class="ot"><-</span> <span class="fu">rank</span>(<span class="sc">-</span>unif_strength<span class="sc">$</span>Strength, <span class="at">ties.method =</span> <span class="st">"average"</span>)</span>
<span id="cb15-18"><a href="#cb15-18" aria-hidden="true" tabindex="-1"></a>unif_strength <span class="ot"><-</span> <span class="fu">arrange</span>(unif_strength, True_Rank)</span>
<span id="cb15-19"><a href="#cb15-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb15-20"><a href="#cb15-20" aria-hidden="true" tabindex="-1"></a><span class="co"># Store strength data frames in a list</span></span>
<span id="cb15-21"><a href="#cb15-21" aria-hidden="true" tabindex="-1"></a>strengths_list <span class="ot"><-</span> <span class="fu">list</span>(</span>
<span id="cb15-22"><a href="#cb15-22" aria-hidden="true" tabindex="-1"></a> <span class="st">"Normal"</span> <span class="ot">=</span> normal_strengths,</span>
<span id="cb15-23"><a href="#cb15-23" aria-hidden="true" tabindex="-1"></a> <span class="st">"Uniform"</span> <span class="ot">=</span> unif_strength</span>
<span id="cb15-24"><a href="#cb15-24" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="simulating-a-tournament" class="level1">
<h1>Simulating a Tournament</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># defining the rank value for each finish</span></span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a>rank_values <span class="ot"><-</span> <span class="fu">c</span>(</span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a> <span class="co"># Add more ranks as needed</span></span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a> <span class="at">quarterfinalist =</span> <span class="fl">6.5</span>,</span>
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a> <span class="at">semifinalist =</span> <span class="fl">3.5</span>,</span>
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a> <span class="at">finalist =</span> <span class="dv">2</span>,</span>
<span id="cb16-7"><a href="#cb16-7" aria-hidden="true" tabindex="-1"></a> <span class="at">champion =</span> <span class="dv">1</span></span>
<span id="cb16-8"><a href="#cb16-8" aria-hidden="true" tabindex="-1"></a>)</span>
<span id="cb16-9"><a href="#cb16-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb16-10"><a href="#cb16-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Remove ties in rankings</span></span>
<span id="cb16-11"><a href="#cb16-11" aria-hidden="true" tabindex="-1"></a>noTies <span class="ot"><-</span> <span class="cf">function</span>(df) {</span>
<span id="cb16-12"><a href="#cb16-12" aria-hidden="true" tabindex="-1"></a> quarterfinals <span class="ot"><-</span> df <span class="sc">%>%</span></span>
<span id="cb16-13"><a href="#cb16-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(Ranks <span class="sc">==</span> rank_values[<span class="st">"quarterfinalist"</span>]) <span class="sc">%>%</span></span>
<span id="cb16-14"><a href="#cb16-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">Ranks =</span> <span class="fu">sample</span>(<span class="dv">5</span><span class="sc">:</span><span class="dv">8</span>, <span class="fu">n</span>(), <span class="at">replace =</span> <span class="cn">FALSE</span>)) <span class="co"># Assigns unique ranks</span></span>
<span id="cb16-15"><a href="#cb16-15" aria-hidden="true" tabindex="-1"></a> semifinals <span class="ot"><-</span> df <span class="sc">%>%</span></span>
<span id="cb16-16"><a href="#cb16-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(Ranks <span class="sc">==</span> rank_values[<span class="st">"semifinalist"</span>]) <span class="sc">%>%</span></span>
<span id="cb16-17"><a href="#cb16-17" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">Ranks =</span> <span class="fu">sample</span>(<span class="dv">3</span><span class="sc">:</span><span class="dv">4</span>, <span class="fu">n</span>(), <span class="at">replace =</span> <span class="cn">FALSE</span>))</span>
<span id="cb16-18"><a href="#cb16-18" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-19"><a href="#cb16-19" aria-hidden="true" tabindex="-1"></a> df <span class="ot"><-</span> df <span class="sc">%>%</span></span>
<span id="cb16-20"><a href="#cb16-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(Ranks <span class="sc">!=</span> rank_values[<span class="st">"quarterfinalist"</span>], Ranks <span class="sc">!=</span> rank_values[<span class="st">"semifinalist"</span>]) <span class="sc">%>%</span></span>
<span id="cb16-21"><a href="#cb16-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">bind_rows</span>(quarterfinals,semifinals) <span class="co"># Replace old quarterfinalists with unique ranks</span></span>
<span id="cb16-22"><a href="#cb16-22" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-23"><a href="#cb16-23" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(df)</span>
<span id="cb16-24"><a href="#cb16-24" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb16-25"><a href="#cb16-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb16-26"><a href="#cb16-26" aria-hidden="true" tabindex="-1"></a><span class="co"># Simulate the single-elimination tournament</span></span>
<span id="cb16-27"><a href="#cb16-27" aria-hidden="true" tabindex="-1"></a>simulate_tournament <span class="ot"><-</span> <span class="cf">function</span>(df,<span class="at">seeding_structure =</span> <span class="cn">NULL</span>, <span class="at">ties=</span><span class="cn">TRUE</span>) {</span>
<span id="cb16-28"><a href="#cb16-28" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-29"><a href="#cb16-29" aria-hidden="true" tabindex="-1"></a> <span class="co"># Sets seed to that of common best vs worst structure</span></span>
<span id="cb16-30"><a href="#cb16-30" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">is.null</span>(seeding_structure)){</span>
<span id="cb16-31"><a href="#cb16-31" aria-hidden="true" tabindex="-1"></a> seeding_structure <span class="ot"><-</span> <span class="fu">matrix</span>(<span class="fu">c</span>(<span class="dv">1</span>,<span class="dv">8</span>,<span class="dv">2</span>,<span class="dv">3</span>,<span class="dv">4</span>,<span class="dv">6</span>,<span class="dv">5</span>,<span class="dv">7</span>), <span class="at">nrow =</span> <span class="dv">1</span>)</span>
<span id="cb16-32"><a href="#cb16-32" aria-hidden="true" tabindex="-1"></a> } </span>
<span id="cb16-33"><a href="#cb16-33" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-34"><a href="#cb16-34" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-35"><a href="#cb16-35" aria-hidden="true" tabindex="-1"></a> results <span class="ot"><-</span> <span class="fu">list</span>() <span class="co"># Initialize the results list</span></span>
<span id="cb16-36"><a href="#cb16-36" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-37"><a href="#cb16-37" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> (i <span class="cf">in</span> <span class="dv">1</span><span class="sc">:</span><span class="fu">nrow</span>(seeding_structure)) {</span>
<span id="cb16-38"><a href="#cb16-38" aria-hidden="true" tabindex="-1"></a> <span class="co"># Create a new data frame based on the current permutation in 'test'</span></span>
<span id="cb16-39"><a href="#cb16-39" aria-hidden="true" tabindex="-1"></a> permutation <span class="ot"><-</span> seeding_structure[i, ]</span>
<span id="cb16-40"><a href="#cb16-40" aria-hidden="true" tabindex="-1"></a> permuted_df <span class="ot"><-</span> df</span>
<span id="cb16-41"><a href="#cb16-41" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Team <span class="ot"><-</span> df<span class="sc">$</span>Team[permutation] <span class="co"># Update team order </span></span>
<span id="cb16-42"><a href="#cb16-42" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Strength <span class="ot"><-</span> df<span class="sc">$</span>Strength[permutation]</span>
<span id="cb16-43"><a href="#cb16-43" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks <span class="ot"><-</span> <span class="cn">NA</span> <span class="co"># Initialize ranks column</span></span>
<span id="cb16-44"><a href="#cb16-44" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Wins <span class="ot"><-</span> <span class="dv">0</span> <span class="co"># Initialize wins column</span></span>
<span id="cb16-45"><a href="#cb16-45" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>True_Rank <span class="ot"><-</span> df<span class="sc">$</span>True_Rank[permutation]</span>
<span id="cb16-46"><a href="#cb16-46" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-47"><a href="#cb16-47" aria-hidden="true" tabindex="-1"></a> teams <span class="ot"><-</span> permuted_df<span class="sc">$</span>Team</span>
<span id="cb16-48"><a href="#cb16-48" aria-hidden="true" tabindex="-1"></a> strengths <span class="ot"><-</span> permuted_df<span class="sc">$</span>Strength</span>
<span id="cb16-49"><a href="#cb16-49" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-50"><a href="#cb16-50" aria-hidden="true" tabindex="-1"></a> round_number <span class="ot"><-</span> <span class="fu">log2</span>(<span class="fu">length</span>(teams))</span>
<span id="cb16-51"><a href="#cb16-51" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-52"><a href="#cb16-52" aria-hidden="true" tabindex="-1"></a> <span class="cf">while</span> (<span class="fu">length</span>(teams) <span class="sc">></span> <span class="dv">1</span>) {</span>
<span id="cb16-53"><a href="#cb16-53" aria-hidden="true" tabindex="-1"></a> <span class="co">#cat("\n--- New Round ---\n")</span></span>
<span id="cb16-54"><a href="#cb16-54" aria-hidden="true" tabindex="-1"></a> next_round <span class="ot"><-</span> <span class="fu">c</span>() <span class="co"># Makes sure only winners are included in next round</span></span>
<span id="cb16-55"><a href="#cb16-55" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-56"><a href="#cb16-56" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> (j <span class="cf">in</span> <span class="fu">seq</span>(<span class="dv">1</span>, <span class="fu">length</span>(teams), <span class="at">by =</span> <span class="dv">2</span>)) { <span class="co"># Gets 2 teams for each match</span></span>
<span id="cb16-57"><a href="#cb16-57" aria-hidden="true" tabindex="-1"></a> team1 <span class="ot"><-</span> teams[j]</span>
<span id="cb16-58"><a href="#cb16-58" aria-hidden="true" tabindex="-1"></a> team2 <span class="ot"><-</span> teams[j<span class="sc">+</span><span class="dv">1</span>]</span>
<span id="cb16-59"><a href="#cb16-59" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-60"><a href="#cb16-60" aria-hidden="true" tabindex="-1"></a> strength1 <span class="ot"><-</span> strengths[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1]</span>
<span id="cb16-61"><a href="#cb16-61" aria-hidden="true" tabindex="-1"></a> strength2 <span class="ot"><-</span> strengths[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2]</span>
<span id="cb16-62"><a href="#cb16-62" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-63"><a href="#cb16-63" aria-hidden="true" tabindex="-1"></a> match_winner <span class="ot"><-</span> <span class="fu">simulate_match</span>(team1, team2, strength1, strength2)</span>
<span id="cb16-64"><a href="#cb16-64" aria-hidden="true" tabindex="-1"></a> next_round <span class="ot"><-</span> <span class="fu">c</span>(next_round, match_winner)</span>
<span id="cb16-65"><a href="#cb16-65" aria-hidden="true" tabindex="-1"></a> <span class="co">#cat(paste(team1, "vs", team2, "-> Winner:", match_winner, "\n"))</span></span>
<span id="cb16-66"><a href="#cb16-66" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-67"><a href="#cb16-67" aria-hidden="true" tabindex="-1"></a> <span class="co"># Can add more rounds by the same code with rounnd_number increasing by 1 and rank_values[round name]</span></span>
<span id="cb16-68"><a href="#cb16-68" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-69"><a href="#cb16-69" aria-hidden="true" tabindex="-1"></a> <span class="co"># Assign ranks based on the current round</span></span>
<span id="cb16-70"><a href="#cb16-70" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (round_number <span class="sc">==</span> <span class="dv">3</span>) { <span class="co"># Quarterfinals</span></span>
<span id="cb16-71"><a href="#cb16-71" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (match_winner <span class="sc">==</span> team1) {</span>
<span id="cb16-72"><a href="#cb16-72" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2] <span class="ot"><-</span> </span>
<span id="cb16-73"><a href="#cb16-73" aria-hidden="true" tabindex="-1"></a> rank_values[<span class="st">"quarterfinalist"</span>]</span>
<span id="cb16-74"><a href="#cb16-74" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> {</span>
<span id="cb16-75"><a href="#cb16-75" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1] <span class="ot"><-</span> </span>
<span id="cb16-76"><a href="#cb16-76" aria-hidden="true" tabindex="-1"></a> rank_values[<span class="st">"quarterfinalist"</span>]</span>
<span id="cb16-77"><a href="#cb16-77" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-78"><a href="#cb16-78" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> <span class="cf">if</span> (round_number <span class="sc">==</span> <span class="dv">2</span>) { <span class="co"># Semifinals</span></span>
<span id="cb16-79"><a href="#cb16-79" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (match_winner <span class="sc">==</span> team1) {</span>
<span id="cb16-80"><a href="#cb16-80" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2] <span class="ot"><-</span></span>
<span id="cb16-81"><a href="#cb16-81" aria-hidden="true" tabindex="-1"></a> rank_values[<span class="st">"semifinalist"</span>]</span>
<span id="cb16-82"><a href="#cb16-82" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> {</span>
<span id="cb16-83"><a href="#cb16-83" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1] <span class="ot"><-</span></span>
<span id="cb16-84"><a href="#cb16-84" aria-hidden="true" tabindex="-1"></a> rank_values[<span class="st">"semifinalist"</span>]</span>
<span id="cb16-85"><a href="#cb16-85" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-86"><a href="#cb16-86" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> <span class="cf">if</span> (round_number <span class="sc">==</span> <span class="dv">1</span>) { <span class="co"># Finals</span></span>
<span id="cb16-87"><a href="#cb16-87" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (match_winner <span class="sc">==</span> team1) {</span>
<span id="cb16-88"><a href="#cb16-88" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2] <span class="ot"><-</span> rank_values[<span class="st">"finalist"</span>]</span>
<span id="cb16-89"><a href="#cb16-89" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1] <span class="ot"><-</span> rank_values[<span class="st">"champion"</span>]</span>
<span id="cb16-90"><a href="#cb16-90" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Wins[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1] <span class="ot"><-</span></span>
<span id="cb16-91"><a href="#cb16-91" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Wins[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1] <span class="sc">+</span> <span class="dv">1</span></span>
<span id="cb16-92"><a href="#cb16-92" aria-hidden="true" tabindex="-1"></a> } <span class="cf">else</span> {</span>
<span id="cb16-93"><a href="#cb16-93" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team1] <span class="ot"><-</span> rank_values[<span class="st">"finalist"</span>]</span>
<span id="cb16-94"><a href="#cb16-94" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Ranks[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2] <span class="ot"><-</span> rank_values[<span class="st">"champion"</span>]</span>
<span id="cb16-95"><a href="#cb16-95" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Wins[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2] <span class="ot"><-</span></span>
<span id="cb16-96"><a href="#cb16-96" aria-hidden="true" tabindex="-1"></a> permuted_df<span class="sc">$</span>Wins[permuted_df<span class="sc">$</span>Team <span class="sc">==</span> team2] <span class="sc">+</span> <span class="dv">1</span></span>
<span id="cb16-97"><a href="#cb16-97" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-98"><a href="#cb16-98" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-99"><a href="#cb16-99" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-100"><a href="#cb16-100" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-101"><a href="#cb16-101" aria-hidden="true" tabindex="-1"></a> teams <span class="ot"><-</span> next_round <span class="co"># Winners move to the next round</span></span>
<span id="cb16-102"><a href="#cb16-102" aria-hidden="true" tabindex="-1"></a> round_number <span class="ot"><-</span> round_number <span class="sc">-</span> <span class="dv">1</span></span>
<span id="cb16-103"><a href="#cb16-103" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-104"><a href="#cb16-104" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-105"><a href="#cb16-105" aria-hidden="true" tabindex="-1"></a> results[[i]] <span class="ot"><-</span> permuted_df <span class="co"># Store the results of this permutation</span></span>
<span id="cb16-106"><a href="#cb16-106" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-107"><a href="#cb16-107" aria-hidden="true" tabindex="-1"></a> final_results <span class="ot"><-</span> <span class="fu">do.call</span>(rbind, results)</span>
<span id="cb16-108"><a href="#cb16-108" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-109"><a href="#cb16-109" aria-hidden="true" tabindex="-1"></a> <span class="co"># Remove ties if ties = FALSE</span></span>
<span id="cb16-110"><a href="#cb16-110" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> (<span class="sc">!</span>ties) {</span>
<span id="cb16-111"><a href="#cb16-111" aria-hidden="true" tabindex="-1"></a> final_results <span class="ot"><-</span> <span class="fu">noTies</span>(final_results)</span>
<span id="cb16-112"><a href="#cb16-112" aria-hidden="true" tabindex="-1"></a> }</span>
<span id="cb16-113"><a href="#cb16-113" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb16-114"><a href="#cb16-114" aria-hidden="true" tabindex="-1"></a> <span class="fu">return</span>(final_results)</span>
<span id="cb16-115"><a href="#cb16-115" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb16-116"><a href="#cb16-116" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb16-117"><a href="#cb16-117" aria-hidden="true" tabindex="-1"></a>test <span class="ot"><-</span> <span class="fu">simulate_tournament</span>(normal_strengths,<span class="at">ties=</span><span class="cn">FALSE</span>)</span>
<span id="cb16-118"><a href="#cb16-118" aria-hidden="true" tabindex="-1"></a>test[<span class="fu">order</span>(<span class="sc">-</span>test<span class="sc">$</span>Strength),]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> Team Strength Wins Ranks True_Rank
1 Team 1 1.2206403 1 1 1
4 Team 2 0.7647097 0 8 2
7 Team 3 0.4307273 0 3 3
2 Team 4 0.1397103 0 2 4
8 Team 5 -0.1397103 0 4 5
5 Team 6 -0.4307273 0 6 6
6 Team 7 -0.7647097 0 7 7
3 Team 8 -1.2206403 0 5 8</code></pre>
</div>
<div class="sourceCode cell-code" id="cb18"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Run the tournament simulation</span></span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a>simulation_results <span class="ot"><-</span> <span class="fu">replicate</span>(<span class="dv">10000</span>, <span class="fu">simulate_tournament</span>(unif_strength), <span class="at">simplify =</span> <span class="cn">FALSE</span>)</span>
<span id="cb18-3"><a href="#cb18-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-4"><a href="#cb18-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Combine all replicate results</span></span>
<span id="cb18-5"><a href="#cb18-5" aria-hidden="true" tabindex="-1"></a>all_results <span class="ot"><-</span> <span class="fu">do.call</span>(rbind, simulation_results)</span>
<span id="cb18-6"><a href="#cb18-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-7"><a href="#cb18-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Summarize total wins</span></span>
<span id="cb18-8"><a href="#cb18-8" aria-hidden="true" tabindex="-1"></a>total_wins_summary <span class="ot"><-</span> all_results <span class="sc">%>%</span></span>
<span id="cb18-9"><a href="#cb18-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(Team) <span class="sc">%>%</span></span>
<span id="cb18-10"><a href="#cb18-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(</span>
<span id="cb18-11"><a href="#cb18-11" aria-hidden="true" tabindex="-1"></a> <span class="at">Total_Wins =</span> <span class="fu">sum</span>(Wins, <span class="at">na.rm =</span> <span class="cn">TRUE</span>),</span>
<span id="cb18-12"><a href="#cb18-12" aria-hidden="true" tabindex="-1"></a> <span class="at">.groups =</span> <span class="st">'drop'</span></span>
<span id="cb18-13"><a href="#cb18-13" aria-hidden="true" tabindex="-1"></a> ) <span class="sc">%>%</span></span>
<span id="cb18-14"><a href="#cb18-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">arrange</span>(<span class="fu">desc</span>(Total_Wins))</span>
<span id="cb18-15"><a href="#cb18-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-16"><a href="#cb18-16" aria-hidden="true" tabindex="-1"></a><span class="co"># Print the total wins summary</span></span>
<span id="cb18-17"><a href="#cb18-17" aria-hidden="true" tabindex="-1"></a><span class="fu">print</span>(total_wins_summary)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 8 × 2
Team Total_Wins
<chr> <dbl>
1 Team 1 4749
2 Team 2 1906
3 Team 4 1229
4 Team 3 982
5 Team 5 769
6 Team 6 246
7 Team 7 108
8 Team 8 11</code></pre>
</div>
</div>
</section>
<section id="single-tournament-simulation-results" class="level1">
<h1>Single Tournament Simulation Results</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>norm_result <span class="ot"><-</span> <span class="fu">simulate_tournament</span>(normal_strengths,seeding_structure)</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a>norm_result[<span class="fu">order</span>(<span class="sc">-</span>norm_result<span class="sc">$</span>Strength),]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code> Team Strength Wins Ranks True_Rank
1 Team 1 1.2206403 0 3.5 1
9 Team 1 1.2206403 0 2.0 1
17 Team 1 1.2206403 0 6.5 1
25 Team 1 1.2206403 1 1.0 1
33 Team 1 1.2206403 0 3.5 1
41 Team 1 1.2206403 1 1.0 1
49 Team 1 1.2206403 0 3.5 1
57 Team 1 1.2206403 0 3.5 1
65 Team 1 1.2206403 0 6.5 1
73 Team 1 1.2206403 0 6.5 1
81 Team 1 1.2206403 0 3.5 1
89 Team 1 1.2206403 1 1.0 1
97 Team 1 1.2206403 1 1.0 1
105 Team 1 1.2206403 0 3.5 1
113 Team 1 1.2206403 0 6.5 1
121 Team 1 1.2206403 1 1.0 1
129 Team 1 1.2206403 0 6.5 1
137 Team 1 1.2206403 0 3.5 1
145 Team 1 1.2206403 1 1.0 1
153 Team 1 1.2206403 0 6.5 1
161 Team 1 1.2206403 0 6.5 1
169 Team 1 1.2206403 0 6.5 1
177 Team 1 1.2206403 1 1.0 1
185 Team 1 1.2206403 1 1.0 1
193 Team 1 1.2206403 0 3.5 1
201 Team 1 1.2206403 1 1.0 1
209 Team 1 1.2206403 1 1.0 1
217 Team 1 1.2206403 0 2.0 1
225 Team 1 1.2206403 1 1.0 1
233 Team 1 1.2206403 0 6.5 1
241 Team 1 1.2206403 0 6.5 1
249 Team 1 1.2206403 0 6.5 1
257 Team 1 1.2206403 0 3.5 1
265 Team 1 1.2206403 0 3.5 1
273 Team 1 1.2206403 0 6.5 1
281 Team 1 1.2206403 1 1.0 1
289 Team 1 1.2206403 0 3.5 1
297 Team 1 1.2206403 1 1.0 1
305 Team 1 1.2206403 0 6.5 1
313 Team 1 1.2206403 1 1.0 1
321 Team 1 1.2206403 1 1.0 1
329 Team 1 1.2206403 0 2.0 1
337 Team 1 1.2206403 0 2.0 1
345 Team 1 1.2206403 0 6.5 1
353 Team 1 1.2206403 0 6.5 1
361 Team 1 1.2206403 0 2.0 1
369 Team 1 1.2206403 0 2.0 1
377 Team 1 1.2206403 0 3.5 1
385 Team 1 1.2206403 0 6.5 1
393 Team 1 1.2206403 1 1.0 1
401 Team 1 1.2206403 1 1.0 1
409 Team 1 1.2206403 0 6.5 1
417 Team 1 1.2206403 1 1.0 1
425 Team 1 1.2206403 1 1.0 1
433 Team 1 1.2206403 1 1.0 1
441 Team 1 1.2206403 0 2.0 1
449 Team 1 1.2206403 0 6.5 1
457 Team 1 1.2206403 1 1.0 1
465 Team 1 1.2206403 0 6.5 1
473 Team 1 1.2206403 0 2.0 1
481 Team 1 1.2206403 1 1.0 1
489 Team 1 1.2206403 0 2.0 1
497 Team 1 1.2206403 1 1.0 1
505 Team 1 1.2206403 0 2.0 1
513 Team 1 1.2206403 1 1.0 1
521 Team 1 1.2206403 1 1.0 1
529 Team 1 1.2206403 1 1.0 1
537 Team 1 1.2206403 1 1.0 1
545 Team 1 1.2206403 1 1.0 1
553 Team 1 1.2206403 1 1.0 1
561 Team 1 1.2206403 0 6.5 1
569 Team 1 1.2206403 0 2.0 1
577 Team 1 1.2206403 1 1.0 1
585 Team 1 1.2206403 1 1.0 1
593 Team 1 1.2206403 0 2.0 1
601 Team 1 1.2206403 1 1.0 1
609 Team 1 1.2206403 0 6.5 1
617 Team 1 1.2206403 0 6.5 1
625 Team 1 1.2206403 1 1.0 1
633 Team 1 1.2206403 1 1.0 1
641 Team 1 1.2206403 0 3.5 1
649 Team 1 1.2206403 1 1.0 1
657 Team 1 1.2206403 1 1.0 1
665 Team 1 1.2206403 1 1.0 1
673 Team 1 1.2206403 0 2.0 1
681 Team 1 1.2206403 0 2.0 1
689 Team 1 1.2206403 1 1.0 1
697 Team 1 1.2206403 1 1.0 1
705 Team 1 1.2206403 0 2.0 1
713 Team 1 1.2206403 0 6.5 1
721 Team 1 1.2206403 0 2.0 1
729 Team 1 1.2206403 1 1.0 1
737 Team 1 1.2206403 1 1.0 1
745 Team 1 1.2206403 1 1.0 1
753 Team 1 1.2206403 0 3.5 1
761 Team 1 1.2206403 0 2.0 1
769 Team 1 1.2206403 0 3.5 1
777 Team 1 1.2206403 0 2.0 1
785 Team 1 1.2206403 0 3.5 1
793 Team 1 1.2206403 0 3.5 1
801 Team 1 1.2206403 1 1.0 1
809 Team 1 1.2206403 0 3.5 1
817 Team 1 1.2206403 0 2.0 1
825 Team 1 1.2206403 0 3.5 1
833 Team 1 1.2206403 0 6.5 1
841 Team 1 1.2206403 0 2.0 1
849 Team 1 1.2206403 1 1.0 1
857 Team 1 1.2206403 0 3.5 1
865 Team 1 1.2206403 1 1.0 1
873 Team 1 1.2206403 0 6.5 1
881 Team 1 1.2206403 0 6.5 1
889 Team 1 1.2206403 0 6.5 1
897 Team 1 1.2206403 0 6.5 1
905 Team 1 1.2206403 1 1.0 1
913 Team 1 1.2206403 1 1.0 1
921 Team 1 1.2206403 1 1.0 1
929 Team 1 1.2206403 0 2.0 1
937 Team 1 1.2206403 1 1.0 1
945 Team 1 1.2206403 0 3.5 1
953 Team 1 1.2206403 1 1.0 1
961 Team 1 1.2206403 0 3.5 1
969 Team 1 1.2206403 1 1.0 1
977 Team 1 1.2206403 0 6.5 1
985 Team 1 1.2206403 0 3.5 1
993 Team 1 1.2206403 1 1.0 1
1001 Team 1 1.2206403 0 3.5 1
1009 Team 1 1.2206403 1 1.0 1
1017 Team 1 1.2206403 0 3.5 1
1025 Team 1 1.2206403 0 6.5 1
1033 Team 1 1.2206403 0 2.0 1
1041 Team 1 1.2206403 1 1.0 1
1049 Team 1 1.2206403 0 3.5 1
1057 Team 1 1.2206403 1 1.0 1
1065 Team 1 1.2206403 0 6.5 1
1073 Team 1 1.2206403 0 6.5 1
1081 Team 1 1.2206403 0 3.5 1
1089 Team 1 1.2206403 1 1.0 1
1097 Team 1 1.2206403 1 1.0 1
1105 Team 1 1.2206403 0 2.0 1
1113 Team 1 1.2206403 0 2.0 1
1121 Team 1 1.2206403 1 1.0 1
1129 Team 1 1.2206403 1 1.0 1
1137 Team 1 1.2206403 1 1.0 1
1145 Team 1 1.2206403 0 6.5 1
1153 Team 1 1.2206403 1 1.0 1
1161 Team 1 1.2206403 1 1.0 1
1169 Team 1 1.2206403 0 2.0 1
1177 Team 1 1.2206403 1 1.0 1
1185 Team 1 1.2206403 1 1.0 1
1193 Team 1 1.2206403 1 1.0 1
1201 Team 1 1.2206403 1 1.0 1
1209 Team 1 1.2206403 0 3.5 1
1217 Team 1 1.2206403 0 3.5 1
1225 Team 1 1.2206403 0 2.0 1
1233 Team 1 1.2206403 0 6.5 1
1241 Team 1 1.2206403 0 6.5 1
1249 Team 1 1.2206403 0 6.5 1
1257 Team 1 1.2206403 1 1.0 1
1265 Team 1 1.2206403 0 6.5 1
1273 Team 1 1.2206403 0 6.5 1
1281 Team 1 1.2206403 1 1.0 1
1289 Team 1 1.2206403 1 1.0 1
1297 Team 1 1.2206403 0 2.0 1
1305 Team 1 1.2206403 0 6.5 1
1313 Team 1 1.2206403 0 3.5 1
1321 Team 1 1.2206403 0 6.5 1
1329 Team 1 1.2206403 0 3.5 1
1337 Team 1 1.2206403 0 3.5 1
1345 Team 1 1.2206403 0 2.0 1
1353 Team 1 1.2206403 1 1.0 1
1361 Team 1 1.2206403 0 3.5 1
1369 Team 1 1.2206403 0 2.0 1
1377 Team 1 1.2206403 0 6.5 1
1385 Team 1 1.2206403 0 3.5 1
1393 Team 1 1.2206403 1 1.0 1
1401 Team 1 1.2206403 0 3.5 1
1409 Team 1 1.2206403 0 3.5 1
1417 Team 1 1.2206403 0 2.0 1
1425 Team 1 1.2206403 1 1.0 1
1433 Team 1 1.2206403 0 6.5 1
1441 Team 1 1.2206403 1 1.0 1
1449 Team 1 1.2206403 1 1.0 1
1457 Team 1 1.2206403 0 6.5 1
1465 Team 1 1.2206403 0 6.5 1
1473 Team 1 1.2206403 1 1.0 1
1481 Team 1 1.2206403 1 1.0 1
1489 Team 1 1.2206403 1 1.0 1
1497 Team 1 1.2206403 0 3.5 1
1505 Team 1 1.2206403 1 1.0 1
1513 Team 1 1.2206403 0 3.5 1
1521 Team 1 1.2206403 0 3.5 1
1529 Team 1 1.2206403 0 2.0 1
1537 Team 1 1.2206403 0 2.0 1
1545 Team 1 1.2206403 0 6.5 1
1553 Team 1 1.2206403 0 2.0 1
1561 Team 1 1.2206403 0 2.0 1
1569 Team 1 1.2206403 0 6.5 1
1577 Team 1 1.2206403 0 2.0 1
1585 Team 1 1.2206403 1 1.0 1
1593 Team 1 1.2206403 1 1.0 1
1601 Team 1 1.2206403 0 2.0 1
1609 Team 1 1.2206403 0 6.5 1
1617 Team 1 1.2206403 1 1.0 1
1625 Team 1 1.2206403 0 6.5 1
1633 Team 1 1.2206403 0 2.0 1
1641 Team 1 1.2206403 1 1.0 1
1649 Team 1 1.2206403 0 3.5 1
1657 Team 1 1.2206403 0 6.5 1
1665 Team 1 1.2206403 1 1.0 1
1673 Team 1 1.2206403 1 1.0 1
1681 Team 1 1.2206403 0 3.5 1
1689 Team 1 1.2206403 1 1.0 1
1697 Team 1 1.2206403 0 2.0 1
1705 Team 1 1.2206403 1 1.0 1
1713 Team 1 1.2206403 0 3.5 1
1721 Team 1 1.2206403 1 1.0 1
1729 Team 1 1.2206403 0 2.0 1
1737 Team 1 1.2206403 0 6.5 1
1745 Team 1 1.2206403 1 1.0 1
1753 Team 1 1.2206403 0 6.5 1
1761 Team 1 1.2206403 1 1.0 1
1769 Team 1 1.2206403 0 3.5 1
1777 Team 1 1.2206403 0 6.5 1
1785 Team 1 1.2206403 0 6.5 1
1793 Team 1 1.2206403 0 6.5 1
1801 Team 1 1.2206403 0 6.5 1
1809 Team 1 1.2206403 0 6.5 1
1817 Team 1 1.2206403 0 2.0 1
1825 Team 1 1.2206403 1 1.0 1
1833 Team 1 1.2206403 0 6.5 1
1841 Team 1 1.2206403 0 6.5 1
1849 Team 1 1.2206403 0 6.5 1
1857 Team 1 1.2206403 0 3.5 1
1865 Team 1 1.2206403 0 6.5 1
1873 Team 1 1.2206403 1 1.0 1
1881 Team 1 1.2206403 0 2.0 1
1889 Team 1 1.2206403 0 6.5 1
1897 Team 1 1.2206403 0 6.5 1
1905 Team 1 1.2206403 0 3.5 1
1913 Team 1 1.2206403 1 1.0 1
1921 Team 1 1.2206403 1 1.0 1
1929 Team 1 1.2206403 0 6.5 1
1937 Team 1 1.2206403 1 1.0 1
1945 Team 1 1.2206403 0 6.5 1
1953 Team 1 1.2206403 1 1.0 1
1961 Team 1 1.2206403 1 1.0 1
1969 Team 1 1.2206403 1 1.0 1
1977 Team 1 1.2206403 0 2.0 1
1985 Team 1 1.2206403 0 2.0 1
1993 Team 1 1.2206403 0 6.5 1
2001 Team 1 1.2206403 1 1.0 1
2009 Team 1 1.2206403 0 2.0 1
2017 Team 1 1.2206403 0 2.0 1
2025 Team 1 1.2206403 0 2.0 1
2033 Team 1 1.2206403 1 1.0 1
2041 Team 1 1.2206403 0 6.5 1
2049 Team 1 1.2206403 0 2.0 1
2057 Team 1 1.2206403 1 1.0 1
2065 Team 1 1.2206403 0 2.0 1
2073 Team 1 1.2206403 1 1.0 1
2081 Team 1 1.2206403 1 1.0 1
2089 Team 1 1.2206403 1 1.0 1
2097 Team 1 1.2206403 0 3.5 1
2105 Team 1 1.2206403 0 3.5 1
2113 Team 1 1.2206403 0 6.5 1
2121 Team 1 1.2206403 1 1.0 1
2129 Team 1 1.2206403 0 3.5 1
2137 Team 1 1.2206403 1 1.0 1
2145 Team 1 1.2206403 0 3.5 1
2153 Team 1 1.2206403 0 2.0 1
2161 Team 1 1.2206403 0 3.5 1
2169 Team 1 1.2206403 0 2.0 1
2177 Team 1 1.2206403 1 1.0 1
2185 Team 1 1.2206403 1 1.0 1
2193 Team 1 1.2206403 1 1.0 1
2201 Team 1 1.2206403 1 1.0 1
2209 Team 1 1.2206403 0 3.5 1
2217 Team 1 1.2206403 0 3.5 1
2225 Team 1 1.2206403 1 1.0 1
2233 Team 1 1.2206403 0 3.5 1
2241 Team 1 1.2206403 0 2.0 1
2249 Team 1 1.2206403 0 2.0 1
2257 Team 1 1.2206403 0 3.5 1
2265 Team 1 1.2206403 0 2.0 1
2273 Team 1 1.2206403 0 3.5 1
2281 Team 1 1.2206403 1 1.0 1
2289 Team 1 1.2206403 0 3.5 1
2297 Team 1 1.2206403 0 6.5 1
2305 Team 1 1.2206403 0 3.5 1
2313 Team 1 1.2206403 1 1.0 1
2321 Team 1 1.2206403 0 6.5 1
2329 Team 1 1.2206403 0 3.5 1
2337 Team 1 1.2206403 0 2.0 1
2345 Team 1 1.2206403 1 1.0 1
2353 Team 1 1.2206403 0 6.5 1
2361 Team 1 1.2206403 1 1.0 1
2369 Team 1 1.2206403 0 3.5 1
2377 Team 1 1.2206403 0 3.5 1
2385 Team 1 1.2206403 1 1.0 1
2393 Team 1 1.2206403 0 3.5 1
2401 Team 1 1.2206403 0 6.5 1
2409 Team 1 1.2206403 0 2.0 1
2417 Team 1 1.2206403 0 2.0 1
2425 Team 1 1.2206403 0 3.5 1
2433 Team 1 1.2206403 0 2.0 1
2441 Team 1 1.2206403 1 1.0 1
2449 Team 1 1.2206403 0 3.5 1
2457 Team 1 1.2206403 0 3.5 1
2465 Team 1 1.2206403 0 2.0 1
2473 Team 1 1.2206403 1 1.0 1
2481 Team 1 1.2206403 0 6.5 1
2489 Team 1 1.2206403 0 2.0 1
2497 Team 1 1.2206403 1 1.0 1
2505 Team 1 1.2206403 0 2.0 1
2513 Team 1 1.2206403 1 1.0 1
2 Team 2 0.7647097 0 6.5 2
10 Team 2 0.7647097 0 6.5 2
18 Team 2 0.7647097 0 3.5 2
27 Team 2 0.7647097 0 6.5 2
34 Team 2 0.7647097 0 6.5 2
42 Team 2 0.7647097 0 6.5 2
51 Team 2 0.7647097 1 1.0 2
58 Team 2 0.7647097 0 6.5 2
66 Team 2 0.7647097 0 3.5 2
74 Team 2 0.7647097 0 3.5 2
83 Team 2 0.7647097 1 1.0 2
91 Team 2 0.7647097 0 3.5 2
99 Team 2 0.7647097 0 3.5 2
107 Team 2 0.7647097 1 1.0 2
115 Team 2 0.7647097 1 1.0 2
122 Team 2 0.7647097 0 6.5 2
130 Team 2 0.7647097 1 1.0 2
139 Team 2 0.7647097 0 6.5 2
146 Team 2 0.7647097 0 6.5 2
154 Team 2 0.7647097 1 1.0 2
162 Team 2 0.7647097 1 1.0 2
170 Team 2 0.7647097 0 2.0 2
179 Team 2 0.7647097 0 3.5 2
187 Team 2 0.7647097 0 3.5 2
195 Team 2 0.7647097 1 1.0 2
203 Team 2 0.7647097 0 3.5 2
210 Team 2 0.7647097 0 6.5 2
218 Team 2 0.7647097 0 6.5 2
226 Team 2 0.7647097 0 6.5 2
235 Team 2 0.7647097 1 1.0 2
242 Team 2 0.7647097 0 2.0 2
251 Team 2 0.7647097 1 1.0 2
259 Team 2 0.7647097 0 6.5 2
267 Team 2 0.7647097 1 1.0 2
275 Team 2 0.7647097 0 6.5 2
283 Team 2 0.7647097 0 6.5 2
291 Team 2 0.7647097 1 1.0 2
299 Team 2 0.7647097 0 3.5 2
307 Team 2 0.7647097 0 3.5 2
317 Team 2 0.7647097 0 2.0 2
325 Team 2 0.7647097 0 6.5 2
333 Team 2 0.7647097 0 6.5 2
339 Team 2 0.7647097 0 3.5 2
346 Team 2 0.7647097 1 1.0 2
355 Team 2 0.7647097 0 2.0 2
362 Team 2 0.7647097 0 6.5 2
371 Team 2 0.7647097 0 3.5 2
379 Team 2 0.7647097 1 1.0 2
386 Team 2 0.7647097 1 1.0 2
394 Team 2 0.7647097 0 6.5 2
402 Team 2 0.7647097 0 6.5 2
410 Team 2 0.7647097 0 3.5 2
419 Team 2 0.7647097 0 3.5 2
427 Team 2 0.7647097 0 3.5 2
434 Team 2 0.7647097 0 6.5 2
443 Team 2 0.7647097 0 3.5 2
450 Team 2 0.7647097 0 3.5 2
459 Team 2 0.7647097 0 6.5 2
466 Team 2 0.7647097 0 2.0 2
474 Team 2 0.7647097 0 6.5 2
483 Team 2 0.7647097 0 6.5 2
491 Team 2 0.7647097 0 3.5 2
499 Team 2 0.7647097 0 6.5 2
506 Team 2 0.7647097 0 6.5 2
514 Team 2 0.7647097 0 6.5 2
523 Team 2 0.7647097 0 3.5 2
530 Team 2 0.7647097 0 6.5 2
538 Team 2 0.7647097 0 6.5 2
546 Team 2 0.7647097 0 6.5 2
555 Team 2 0.7647097 0 3.5 2
563 Team 2 0.7647097 0 6.5 2
571 Team 2 0.7647097 0 3.5 2
581 Team 2 0.7647097 0 3.5 2
589 Team 2 0.7647097 0 2.0 2
597 Team 2 0.7647097 0 3.5 2
605 Team 2 0.7647097 0 2.0 2
613 Team 2 0.7647097 0 6.5 2
621 Team 2 0.7647097 0 3.5 2
629 Team 2 0.7647097 0 2.0 2
637 Team 2 0.7647097 0 3.5 2
645 Team 2 0.7647097 0 6.5 2
653 Team 2 0.7647097 0 2.0 2
661 Team 2 0.7647097 0 2.0 2
669 Team 2 0.7647097 0 2.0 2
677 Team 2 0.7647097 1 1.0 2
685 Team 2 0.7647097 0 6.5 2
693 Team 2 0.7647097 0 6.5 2
699 Team 2 0.7647097 0 3.5 2
707 Team 2 0.7647097 0 3.5 2
715 Team 2 0.7647097 0 3.5 2
725 Team 2 0.7647097 1 1.0 2
733 Team 2 0.7647097 0 3.5 2
741 Team 2 0.7647097 0 3.5 2
747 Team 2 0.7647097 0 3.5 2
755 Team 2 0.7647097 1 1.0 2
763 Team 2 0.7647097 0 3.5 2
771 Team 2 0.7647097 1 1.0 2
779 Team 2 0.7647097 0 3.5 2
787 Team 2 0.7647097 0 6.5 2
795 Team 2 0.7647097 0 6.5 2
803 Team 2 0.7647097 0 3.5 2
811 Team 2 0.7647097 1 1.0 2
821 Team 2 0.7647097 1 1.0 2
829 Team 2 0.7647097 0 6.5 2
837 Team 2 0.7647097 0 3.5 2
845 Team 2 0.7647097 1 1.0 2
853 Team 2 0.7647097 0 6.5 2
861 Team 2 0.7647097 0 6.5 2
869 Team 2 0.7647097 0 6.5 2
877 Team 2 0.7647097 0 6.5 2
885 Team 2 0.7647097 0 3.5 2
891 Team 2 0.7647097 0 6.5 2
899 Team 2 0.7647097 0 2.0 2
907 Team 2 0.7647097 0 3.5 2
917 Team 2 0.7647097 0 6.5 2
925 Team 2 0.7647097 0 2.0 2
933 Team 2 0.7647097 0 3.5 2
938 Team 2 0.7647097 0 6.5 2
946 Team 2 0.7647097 0 6.5 2
954 Team 2 0.7647097 0 6.5 2
962 Team 2 0.7647097 0 6.5 2
971 Team 2 0.7647097 0 3.5 2
978 Team 2 0.7647097 0 3.5 2
987 Team 2 0.7647097 1 1.0 2
994 Team 2 0.7647097 0 6.5 2
1002 Team 2 0.7647097 0 6.5 2
1011 Team 2 0.7647097 0 3.5 2
1019 Team 2 0.7647097 0 6.5 2
1027 Team 2 0.7647097 0 2.0 2
1034 Team 2 0.7647097 0 6.5 2
1042 Team 2 0.7647097 0 6.5 2
1051 Team 2 0.7647097 1 1.0 2
1058 Team 2 0.7647097 0 6.5 2
1066 Team 2 0.7647097 0 2.0 2
1074 Team 2 0.7647097 1 1.0 2
1083 Team 2 0.7647097 1 1.0 2
1091 Team 2 0.7647097 0 3.5 2
1099 Team 2 0.7647097 0 3.5 2
1109 Team 2 0.7647097 0 6.5 2
1117 Team 2 0.7647097 1 1.0 2
1125 Team 2 0.7647097 0 2.0 2
1131 Team 2 0.7647097 0 6.5 2
1139 Team 2 0.7647097 0 6.5 2
1147 Team 2 0.7647097 0 3.5 2
1155 Team 2 0.7647097 0 3.5 2
1163 Team 2 0.7647097 0 3.5 2
1171 Team 2 0.7647097 0 6.5 2
1179 Team 2 0.7647097 0 6.5 2
1189 Team 2 0.7647097 0 2.0 2
1197 Team 2 0.7647097 0 6.5 2
1205 Team 2 0.7647097 0 2.0 2
1211 Team 2 0.7647097 1 1.0 2
1219 Team 2 0.7647097 1 1.0 2
1227 Team 2 0.7647097 0 3.5 2
1235 Team 2 0.7647097 1 1.0 2
1243 Team 2 0.7647097 1 1.0 2
1253 Team 2 0.7647097 1 1.0 2
1261 Team 2 0.7647097 0 3.5 2
1269 Team 2 0.7647097 0 3.5 2
1277 Team 2 0.7647097 0 3.5 2
1285 Team 2 0.7647097 0 6.5 2
1293 Team 2 0.7647097 0 6.5 2
1301 Team 2 0.7647097 1 1.0 2
1309 Team 2 0.7647097 0 6.5 2
1317 Team 2 0.7647097 1 1.0 2
1325 Team 2 0.7647097 0 3.5 2
1333 Team 2 0.7647097 1 1.0 2
1341 Team 2 0.7647097 0 6.5 2
1349 Team 2 0.7647097 1 1.0 2
1357 Team 2 0.7647097 0 2.0 2
1365 Team 2 0.7647097 0 2.0 2
1373 Team 2 0.7647097 1 1.0 2
1381 Team 2 0.7647097 0 2.0 2
1389 Team 2 0.7647097 0 3.5 2
1397 Team 2 0.7647097 0 2.0 2
1405 Team 2 0.7647097 0 2.0 2
1413 Team 2 0.7647097 1 1.0 2
1419 Team 2 0.7647097 0 3.5 2
1427 Team 2 0.7647097 0 6.5 2
1435 Team 2 0.7647097 1 1.0 2
1445 Team 2 0.7647097 0 3.5 2
1453 Team 2 0.7647097 0 2.0 2
1461 Team 2 0.7647097 1 1.0 2
1469 Team 2 0.7647097 0 6.5 2
1477 Team 2 0.7647097 0 3.5 2
1485 Team 2 0.7647097 0 6.5 2
1493 Team 2 0.7647097 0 2.0 2
1501 Team 2 0.7647097 1 1.0 2
1509 Team 2 0.7647097 0 2.0 2
1517 Team 2 0.7647097 0 3.5 2
1525 Team 2 0.7647097 0 6.5 2
1533 Team 2 0.7647097 1 1.0 2
1541 Team 2 0.7647097 1 1.0 2
1549 Team 2 0.7647097 0 6.5 2
1557 Team 2 0.7647097 1 1.0 2
1565 Team 2 0.7647097 0 6.5 2
1573 Team 2 0.7647097 1 1.0 2
1581 Team 2 0.7647097 0 3.5 2
1589 Team 2 0.7647097 0 6.5 2
1597 Team 2 0.7647097 0 6.5 2
1605 Team 2 0.7647097 0 3.5 2
1613 Team 2 0.7647097 1 1.0 2
1621 Team 2 0.7647097 0 6.5 2
1629 Team 2 0.7647097 0 3.5 2
1637 Team 2 0.7647097 0 6.5 2
1645 Team 2 0.7647097 0 3.5 2
1653 Team 2 0.7647097 1 1.0 2
1661 Team 2 0.7647097 0 2.0 2
1669 Team 2 0.7647097 0 3.5 2
1677 Team 2 0.7647097 0 2.0 2
1685 Team 2 0.7647097 0 3.5 2
1693 Team 2 0.7647097 0 3.5 2
1701 Team 2 0.7647097 1 1.0 2
1709 Team 2 0.7647097 0 2.0 2
1717 Team 2 0.7647097 1 1.0 2
1725 Team 2 0.7647097 0 6.5 2
1733 Team 2 0.7647097 1 1.0 2
1741 Team 2 0.7647097 1 1.0 2
1749 Team 2 0.7647097 0 2.0 2
1757 Team 2 0.7647097 0 2.0 2
1765 Team 2 0.7647097 0 2.0 2
1773 Team 2 0.7647097 0 2.0 2
1781 Team 2 0.7647097 0 6.5 2
1789 Team 2 0.7647097 1 1.0 2
1797 Team 2 0.7647097 1 1.0 2
1805 Team 2 0.7647097 0 2.0 2
1813 Team 2 0.7647097 1 1.0 2
1821 Team 2 0.7647097 1 1.0 2
1827 Team 2 0.7647097 0 6.5 2
1835 Team 2 0.7647097 0 3.5 2
1843 Team 2 0.7647097 1 1.0 2
1853 Team 2 0.7647097 1 1.0 2
1861 Team 2 0.7647097 0 6.5 2
1869 Team 2 0.7647097 1 1.0 2
1875 Team 2 0.7647097 0 6.5 2
1883 Team 2 0.7647097 0 3.5 2
1891 Team 2 0.7647097 0 3.5 2
1899 Team 2 0.7647097 0 6.5 2
1907 Team 2 0.7647097 1 1.0 2
1915 Team 2 0.7647097 0 3.5 2
1925 Team 2 0.7647097 0 3.5 2
1933 Team 2 0.7647097 0 3.5 2
1941 Team 2 0.7647097 0 3.5 2
1947 Team 2 0.7647097 0 3.5 2
1955 Team 2 0.7647097 0 3.5 2
1963 Team 2 0.7647097 0 6.5 2
1973 Team 2 0.7647097 0 2.0 2
1981 Team 2 0.7647097 1 1.0 2
1989 Team 2 0.7647097 1 1.0 2
1997 Team 2 0.7647097 1 1.0 2
2005 Team 2 0.7647097 0 6.5 2
2013 Team 2 0.7647097 1 1.0 2
2021 Team 2 0.7647097 1 1.0 2
2029 Team 2 0.7647097 1 1.0 2
2037 Team 2 0.7647097 0 2.0 2
2045 Team 2 0.7647097 0 3.5 2
2053 Team 2 0.7647097 1 1.0 2
2061 Team 2 0.7647097 0 2.0 2
2067 Team 2 0.7647097 0 3.5 2
2075 Team 2 0.7647097 0 3.5 2
2083 Team 2 0.7647097 0 3.5 2
2093 Team 2 0.7647097 0 3.5 2
2101 Team 2 0.7647097 0 6.5 2
2109 Team 2 0.7647097 0 6.5 2
2117 Team 2 0.7647097 0 2.0 2
2125 Team 2 0.7647097 0 2.0 2
2133 Team 2 0.7647097 0 6.5 2
2141 Team 2 0.7647097 0 6.5 2
2149 Team 2 0.7647097 0 3.5 2
2157 Team 2 0.7647097 0 6.5 2
2165 Team 2 0.7647097 1 1.0 2
2173 Team 2 0.7647097 1 1.0 2
2181 Team 2 0.7647097 0 6.5 2
2189 Team 2 0.7647097 0 3.5 2
2197 Team 2 0.7647097 0 6.5 2
2205 Team 2 0.7647097 0 6.5 2
2213 Team 2 0.7647097 0 3.5 2
2221 Team 2 0.7647097 0 6.5 2
2229 Team 2 0.7647097 0 2.0 2
2237 Team 2 0.7647097 0 3.5 2
2245 Team 2 0.7647097 0 3.5 2
2253 Team 2 0.7647097 0 3.5 2
2261 Team 2 0.7647097 1 1.0 2
2269 Team 2 0.7647097 1 1.0 2
2277 Team 2 0.7647097 1 1.0 2
2285 Team 2 0.7647097 0 2.0 2
2293 Team 2 0.7647097 0 2.0 2
2301 Team 2 0.7647097 0 3.5 2
2309 Team 2 0.7647097 1 1.0 2
2317 Team 2 0.7647097 0 2.0 2
2325 Team 2 0.7647097 0 2.0 2
2333 Team 2 0.7647097 0 3.5 2
2341 Team 2 0.7647097 1 1.0 2
2349 Team 2 0.7647097 0 6.5 2
2357 Team 2 0.7647097 0 2.0 2
2365 Team 2 0.7647097 0 3.5 2
2373 Team 2 0.7647097 1 1.0 2
2381 Team 2 0.7647097 0 6.5 2
2389 Team 2 0.7647097 0 6.5 2
2397 Team 2 0.7647097 1 1.0 2
2405 Team 2 0.7647097 1 1.0 2
2413 Team 2 0.7647097 1 1.0 2