Skip to content

Commit eae6d8c

Browse files
authored
Merge pull request #194 from atk/tournament
new exercise: tournament
2 parents 90a8af0 + d74e6f5 commit eae6d8c

File tree

13 files changed

+712
-0
lines changed

13 files changed

+712
-0
lines changed

config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,14 @@
535535
"prerequisites": [],
536536
"difficulty": 6
537537
},
538+
{
539+
"slug": "tournament",
540+
"name": "Tournament",
541+
"uuid": "2a9a91e1-dac4-403c-b68a-d6530f0c30bb",
542+
"practices": [],
543+
"prerequisites": [],
544+
"difficulty": 6
545+
},
538546
{
539547
"slug": "meetup",
540548
"name": "Meetup",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Reserved Memory
2+
3+
Bytes 64-447 of the linear memory are reserved for the input string.
4+
5+
The input string can be modified in place if desired.
6+
7+
## Input format
8+
9+
Each line will contain the name of the first team, then a semicolon `;`, then the name of the second team, another semicolon `;`, the outcome of the match (`"win"`, `"draw"`, `"loss"`) and then a line break `\n`.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Instructions
2+
3+
Tally the results of a small football competition.
4+
5+
Based on an input file containing which team played against which and what the outcome was, create a file with a table like this:
6+
7+
```text
8+
Team | MP | W | D | L | P
9+
Devastating Donkeys | 3 | 2 | 1 | 0 | 7
10+
Allegoric Alaskans | 3 | 2 | 0 | 1 | 6
11+
Blithering Badgers | 3 | 1 | 0 | 2 | 3
12+
Courageous Californians | 3 | 0 | 1 | 2 | 1
13+
```
14+
15+
What do those abbreviations mean?
16+
17+
- MP: Matches Played
18+
- W: Matches Won
19+
- D: Matches Drawn (Tied)
20+
- L: Matches Lost
21+
- P: Points
22+
23+
A win earns a team 3 points.
24+
A draw earns 1.
25+
A loss earns 0.
26+
27+
The outcome is ordered by points, descending.
28+
In case of a tie, teams are ordered alphabetically.
29+
30+
## Input
31+
32+
Your tallying program will receive input that looks like:
33+
34+
```text
35+
Allegoric Alaskans;Blithering Badgers;win
36+
Devastating Donkeys;Courageous Californians;draw
37+
Devastating Donkeys;Allegoric Alaskans;win
38+
Courageous Californians;Blithering Badgers;loss
39+
Blithering Badgers;Devastating Donkeys;loss
40+
Allegoric Alaskans;Courageous Californians;win
41+
```
42+
43+
The result of the match refers to the first team listed.
44+
So this line:
45+
46+
```text
47+
Allegoric Alaskans;Blithering Badgers;win
48+
```
49+
50+
means that the Allegoric Alaskans beat the Blithering Badgers.
51+
52+
This line:
53+
54+
```text
55+
Courageous Californians;Blithering Badgers;loss
56+
```
57+
58+
means that the Blithering Badgers beat the Courageous Californians.
59+
60+
And this line:
61+
62+
```text
63+
Devastating Donkeys;Courageous Californians;draw
64+
```
65+
66+
means that the Devastating Donkeys and Courageous Californians tied.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"root": true,
3+
"extends": "@exercism/eslint-config-javascript",
4+
"env": {
5+
"jest": true
6+
},
7+
"overrides": [
8+
{
9+
"files": [
10+
"*.spec.js"
11+
],
12+
"excludedFiles": [
13+
"custom.spec.js"
14+
],
15+
"extends": "@exercism/eslint-config-javascript/maintainers"
16+
}
17+
]
18+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"authors": [
3+
"atk"
4+
],
5+
"files": {
6+
"solution": [
7+
"tournament.wat"
8+
],
9+
"test": [
10+
"tournament.spec.js"
11+
],
12+
"example": [
13+
".meta/proof.ci.wat"
14+
],
15+
"invalidator": [
16+
"package.json"
17+
]
18+
},
19+
"blurb": "Tally the results of a small football competition.",
20+
"custom": {
21+
"version.tests.compatibility": "jest-27",
22+
"flag.tests.task-per-describe": false,
23+
"flag.tests.may-run-long": false,
24+
"flag.tests.includes-optional": false
25+
}
26+
}

0 commit comments

Comments
 (0)