-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjourneyman.cabal
219 lines (210 loc) · 6.86 KB
/
journeyman.cabal
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
cabal-version: 2.4
name: journeyman
version: 0.1.0.0
license: LGPL-2.1-or-later
copyright: 2023 Mike Ledger
maintainer: [email protected]
author: Mike Ledger
category: Web
extra-source-files:
LICENSE
README.md
description:
<<https://mikeplus64.github.io/journeyman/screenshot.png>>
.
Journeyman is my undergraduate COMP4560 project, with the aim to
create an easy-to-use eDSL that can be used to create and analyse arbitrary
tournament structures; such as "common" ones like Single or Double
Elimination, or compositions like N groups of Single Elimination.
.
* Your entrypoint to the eDSL should be the "Tourney.Algebra" module.
.
* Your entrypoint to exploring what's possible with Journeyman should be
the journeyman-ui executable that comes bundled with this package. It
uses an extensible tournament UI defined in "Tourney.UI.Main", but all
you as a user needs to do is extend the list of known tournaments you
pass to 'Tourney.UI.Main.createTourneyUI' with a tournament you create.
For an example of how to do this, see the executable in @ app/Main.hs @.
.
* To create a special-purpose tournament VM, for instance, to simulate
a tournament structure under different conditions, see the "Tourney.VM"
module. This module also provides functionality for gauging the
performance of a tournament structure by simulating it over a given
Elo rating distribution.
.
* Functions dealing merely with sorting networks or point-award based
sorting networks such as those supported by Journeyman can be found in
"Tourney.SortingNetwork"
.
Some example tournament structures are provided under the @ Tourney.Format.* @
module. Navigating to these and familiarising yourself with the source code via
the /Source/ links may be quite helpful in gaining an intuition for how
Journeyman works and what its capabilities are.
.
= Analogies between sorting networks and tournaments
.
A key observation of made at the outset of this project is that there is an
analogy between sorting networks and many tournament structures. Here, a sorting
network refers to a fixed schedule or "network" of comparisons between a fixed
set of objects. Each comparison has a fixed coordinate or /wire/ in the network,
and results in either the objects staying in the same position as they were (if
they were already in order with respect to eachother), or they exchange places
if not.
.
I call a sorting network "partial" if it does not determine a complete ordering
among players; for instance if out of 16 elements it determines the greatest 8
in order, but leaves the remaining 8 in two buckets of 4 items where only the
order of the buckets is known.
.
A Single Elimination tournament has a partial sorting network construction. This
is because at each round we can draw matches between the winners of the previous
round only; that is, those players that now occupy the "high" position of the
sorting network, after a single step of the network. At the same time, the
losers of each round are simply not given any further comparisons (i.e.,
matches) from the point that they were eliminated, and so remain ranked at
whatever point they were eliminated.
.
Similarly, we can also construct a Double-Elimination tournament by sorting
network, by creating matches between those players that lost in first round of
the "upper" bracket, and then alternating rounds that either accept new losers
from the previous upper bracket round into new matches in the lower bracket, or
that play off players who are in the lower bracket. Not all tournaments are
sorting networks however. For instance, a round robin tournament has no
sorting network equivalent, even though it has a fully-determined
schedule for \(n\) players. To get around this, we define a special primitive that
allows the method by which players exchange positions to be redefined; for
instance, in a round robin, the method is that players shall accumulate points
by winning matches, and then be ordered from most points to least.
.
common shared
ghc-options:
-Wall -Wincomplete-record-updates -Wincomplete-uni-patterns
-Wmissing-deriving-strategies -Wunused-foralls -Wunused-foralls
-fprint-explicit-foralls -fprint-explicit-kinds
-funbox-small-strict-fields
mixins:
base hiding (Prelude),
base (Prelude as BasePrelude)
default-extensions:
NoStarIsType
AllowAmbiguousTypes
BangPatterns
BlockArguments
ConstraintKinds
DataKinds
DefaultSignatures
DeriveAnyClass
DeriveDataTypeable
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
DerivingStrategies
DerivingVia
DuplicateRecordFields
EmptyCase
EmptyDataDecls
EmptyDataDeriving
ExistentialQuantification
ExplicitForAll
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GADTSyntax
GeneralisedNewtypeDeriving
ImportQualifiedPost
KindSignatures
LambdaCase
MultiParamTypeClasses
MultiWayIf
NamedFieldPuns
NumericUnderscores
OverloadedLabels
OverloadedStrings
PatternSynonyms
PolyKinds
PostfixOperators
QuantifiedConstraints
QuasiQuotes
RankNTypes
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
StandaloneKindSignatures
TupleSections
TypeApplications
TypeFamilies
TypeFamilyDependencies
TypeOperators
ViewPatterns
build-depends:
, acc
, aeson
, array
, base >=4.13.0.0 && <4.18.0.0.0
, brick
, colour
, containers
, data-default
, directory
, dlist
, generic-lens
, kan-extensions
, lens
, mtl
, mwc-random
, nonempty-zipper
, palette
, pretty-simple
, primitive
, PyF
, random
, relude
, semialign
, smallcheck
, stm
, these
, transformers
, vector
, vector-algorithms
, vector-builder
, vty
, with-utf8
default-language: Haskell2010
library
import: shared
hs-source-dirs: src
other-modules:
Data.Counting
Data.Dependency
Data.Tuple.Ordered
Prelude
exposed-modules:
Tourney.Algebra
Tourney.Algebra.Builder
Tourney.Algebra.Unified
Tourney.Common
Tourney.Format.DoubleElimination
Tourney.Format.ICantBelieveItCanSort
Tourney.Format.InsertionSort
Tourney.Format.OptimalSortingNetwork
Tourney.Format.RoundRobin
Tourney.Format.SingleElimination
Tourney.Format.Swiss
Tourney.Match
Tourney.Match.Matrix
Tourney.Prelude
Tourney.SortingNetwork
Tourney.Stream
Tourney.UI.Main
Tourney.UI.Selection
Tourney.VM
Tourney.VM.Code
Tourney.VM.Compile
Tourney.VM.Interpret
executable journeyman-ui
import: shared
build-depends: journeyman
hs-source-dirs: app
main-is: Main.hs