trackler 2.2.1.129 → 2.2.1.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/scale-generator/description.md +9 -16
- data/tracks/dart/config.json +9 -9
- data/tracks/dart/exercises/raindrops/lib/raindrops.dart +1 -1
- data/tracks/dart/exercises/raindrops/test/raindrops_test.dart +59 -44
- data/tracks/dart/exercises/rna-transcription/test/rna_transcription_test.dart +37 -44
- data/tracks/fsharp/exercises/go-counting/Example.fs +24 -20
- data/tracks/fsharp/exercises/go-counting/GoCountingTest.fs +110 -51
- data/tracks/fsharp/generators/Generators.fs +84 -0
- data/tracks/java/config.json +13 -13
- data/tracks/purescript/config.json +12 -0
- data/tracks/purescript/exercises/phone-number/README.md +36 -0
- data/tracks/purescript/exercises/phone-number/bower.json +26 -0
- data/tracks/purescript/exercises/phone-number/examples/src/PhoneNumber.purs +30 -0
- data/tracks/purescript/exercises/phone-number/src/PhoneNumber.purs +6 -0
- data/tracks/purescript/exercises/phone-number/test/Main.purs +50 -0
- data/tracks/rust/_test/check-stubs.sh +29 -0
- data/tracks/rust/_test/ensure-stubs-compile.sh +24 -5
- data/tracks/rust/exercises/all-your-base/src/lib.rs +1 -2
- data/tracks/rust/exercises/armstrong-numbers/src/lib.rs +2 -2
- data/tracks/rust/exercises/beer-song/src/lib.rs +2 -2
- data/tracks/rust/exercises/bob/src/lib.rs +1 -1
- data/tracks/rust/exercises/circular-buffer/tests/circular-buffer.rs +96 -101
- data/tracks/rust/exercises/collatz-conjecture/src/lib.rs +4 -2
- data/tracks/rust/exercises/decimal/.meta/description.md +1 -1
- data/tracks/rust/exercises/decimal/README.md +1 -1
- data/tracks/rust/exercises/difference-of-squares/src/lib.rs +6 -3
- data/tracks/rust/exercises/forth/src/lib.rs +1 -1
- data/tracks/rust/exercises/grade-school/src/lib.rs +2 -4
- data/tracks/rust/exercises/grains/src/lib.rs +1 -1
- data/tracks/rust/exercises/leap/src/lib.rs +1 -1
- data/tracks/rust/exercises/macros/.meta/description.md +1 -1
- data/tracks/rust/exercises/macros/README.md +1 -1
- data/tracks/rust/exercises/ocr-numbers/src/lib.rs +1 -2
- data/tracks/rust/exercises/parallel-letter-frequency/.meta/hints.md +1 -1
- data/tracks/rust/exercises/parallel-letter-frequency/README.md +1 -1
- data/tracks/rust/exercises/pascals-triangle/src/lib.rs +1 -1
- data/tracks/rust/exercises/perfect-numbers/src/lib.rs +1 -1
- data/tracks/rust/exercises/prime-factors/src/lib.rs +1 -1
- data/tracks/rust/exercises/proverb/src/lib.rs +1 -1
- data/tracks/rust/exercises/raindrops/src/lib.rs +1 -1
- data/tracks/rust/exercises/react/src/lib.rs +11 -9
- data/tracks/rust/exercises/robot-simulator/src/lib.rs +6 -4
- data/tracks/rust/exercises/saddle-points/src/lib.rs +1 -1
- data/tracks/rust/exercises/simple-linked-list/src/lib.rs +5 -5
- data/tracks/rust/exercises/space-age/src/lib.rs +6 -3
- data/tracks/rust/exercises/sum-of-multiples/src/lib.rs +1 -1
- data/tracks/rust/exercises/two-bucket/src/lib.rs +7 -1
- data/tracks/rust/exercises/variable-length-quantity/src/lib.rs +2 -2
- data/tracks/typescript/exercises/list-ops/list-ops.example.ts +9 -13
- data/tracks/typescript/exercises/list-ops/list-ops.test.ts +9 -17
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 923eff384744b6182eb32fb442de07be36209106
|
4
|
+
data.tar.gz: '02753792b8af2f08857952bb33d769096c5f8bd0'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 418bfe90ffbb922d431bb20b9dd0df31c74bf29ec568e7d84474f91aba5e9ff405b5bd3ffaf9592e0f70506a14a93c0ebe058fdc38fa4a7f65e1f67b04ac64e5
|
7
|
+
data.tar.gz: 8abdcc2a182bca4ec7a7aaf54a40049a02a2ba1d07354580d980172fb416771fcf559cdf3f9a5da1ede3ffe6b33c78e5467e1c0609ebe4b237dd8f98096ea98a
|
data/lib/trackler/version.rb
CHANGED
@@ -2,13 +2,13 @@ Given a tonic, or starting note, and a set of intervals, generate
|
|
2
2
|
the musical scale starting with the tonic and following the
|
3
3
|
specified interval pattern.
|
4
4
|
|
5
|
-
Scales in Western music are based on the chromatic (12-note) scale.This
|
5
|
+
Scales in Western music are based on the chromatic (12-note) scale. This
|
6
6
|
scale can be expressed as the following group of pitches:
|
7
7
|
|
8
8
|
A, A#, B, C, C#, D, D#, E, F, F#, G, G#
|
9
9
|
|
10
|
-
A given sharp note (indicated by a #)
|
11
|
-
of the note above it (indicated by a b)
|
10
|
+
A given sharp note (indicated by a #) can also be expressed as the flat
|
11
|
+
of the note above it (indicated by a b) so the chromatic scale can also be
|
12
12
|
written like this:
|
13
13
|
|
14
14
|
A, Bb, B, C, Db, D, Eb, E, F, Gb, G, Ab
|
@@ -18,9 +18,9 @@ collection. They have seven pitches, and are called diatonic scales.
|
|
18
18
|
The collection of notes in these scales is written with either sharps or
|
19
19
|
flats, depending on the tonic. Here is a list of which are which:
|
20
20
|
|
21
|
-
No
|
21
|
+
No Sharps or Flats:
|
22
22
|
C major
|
23
|
-
|
23
|
+
a minor
|
24
24
|
|
25
25
|
Use Sharps:
|
26
26
|
G, D, A, E, B, F# major
|
@@ -41,14 +41,7 @@ a "whole step" or "major second" (written as an upper-case "M"). The
|
|
41
41
|
diatonic scales are built using only these two intervals between
|
42
42
|
adjacent notes.
|
43
43
|
|
44
|
-
Non-diatonic scales can contain
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
Here is a table of pitches with the names of their interval distance from the tonic (A).
|
49
|
-
|
50
|
-
| A | A# | B | C | C# | D | D# | E | F | F# | G | G# | A |
|
51
|
-
|:------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:------:|
|
52
|
-
| Unison | Min 2nd | Maj 2nd | Min 3rd | Maj 3rd | Per 4th | Tritone | Per 5th | Min 6th | Maj 6th | Min 7th | Maj 7th | Octave |
|
53
|
-
| | | Dim 3rd | Aug 2nd | Dim 4th | | Aug 4th | Dim 5th | Aug 5th | Dim 7th | Aug 6th | Dim 8ve | |
|
54
|
-
| | | | | | | Dim 5th | | | | | | |
|
44
|
+
Non-diatonic scales can contain other intervals. An "augmented first"
|
45
|
+
interval, written "A", has two interceding notes (e.g., from A to C or
|
46
|
+
Db to E). There are also smaller and larger intervals, but they will not
|
47
|
+
figure into this exercise.
|
data/tracks/dart/config.json
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
"integers",
|
24
24
|
"logic"
|
25
25
|
],
|
26
|
-
"unlocked_by":
|
26
|
+
"unlocked_by": null,
|
27
27
|
"uuid": "4bcfd789-dee6-4dd9-8524-076508504eda"
|
28
28
|
},
|
29
29
|
{
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"integers",
|
35
35
|
"mathematics"
|
36
36
|
],
|
37
|
-
"unlocked_by":
|
37
|
+
"unlocked_by": null,
|
38
38
|
"uuid": "c1cdab6f-c18c-4173-828a-2191151d20d4"
|
39
39
|
},
|
40
40
|
{
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"maps",
|
48
48
|
"regular_expressions"
|
49
49
|
],
|
50
|
-
"unlocked_by":
|
50
|
+
"unlocked_by": null,
|
51
51
|
"uuid": "b74dde02-03d0-4165-8302-e8ba119b486b"
|
52
52
|
},
|
53
53
|
{
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"strings",
|
63
63
|
"unicode"
|
64
64
|
],
|
65
|
-
"unlocked_by":
|
65
|
+
"unlocked_by": null,
|
66
66
|
"uuid": "615a83cc-a905-435a-a30e-f052b61cfd4c"
|
67
67
|
},
|
68
68
|
{
|
@@ -75,7 +75,7 @@
|
|
75
75
|
"equality",
|
76
76
|
"strings"
|
77
77
|
],
|
78
|
-
"unlocked_by":
|
78
|
+
"unlocked_by": null,
|
79
79
|
"uuid": "91c8033d-f40c-4a90-9ec9-7081f6eba8d2"
|
80
80
|
},
|
81
81
|
{
|
@@ -98,7 +98,7 @@
|
|
98
98
|
"mathematics",
|
99
99
|
"time"
|
100
100
|
],
|
101
|
-
"unlocked_by":
|
101
|
+
"unlocked_by": null,
|
102
102
|
"uuid": "0c0511fd-59aa-4480-a7cd-4de0e9303b86"
|
103
103
|
},
|
104
104
|
{
|
@@ -111,7 +111,7 @@
|
|
111
111
|
"mathematics",
|
112
112
|
"strings"
|
113
113
|
],
|
114
|
-
"unlocked_by":
|
114
|
+
"unlocked_by": null,
|
115
115
|
"uuid": "3d4e326d-2419-4e93-ac29-5727dbc3fbf1"
|
116
116
|
},
|
117
117
|
{
|
@@ -122,7 +122,7 @@
|
|
122
122
|
"strings",
|
123
123
|
"transforming"
|
124
124
|
],
|
125
|
-
"unlocked_by":
|
125
|
+
"unlocked_by": null,
|
126
126
|
"uuid": "99147c39-e8d3-4166-9215-c47fb4832781"
|
127
127
|
},
|
128
128
|
{
|
@@ -135,7 +135,7 @@
|
|
135
135
|
"equality",
|
136
136
|
"strings"
|
137
137
|
],
|
138
|
-
"unlocked_by":
|
138
|
+
"unlocked_by": null,
|
139
139
|
"uuid": "6e811b53-4eb1-40f9-a811-b5113d68ae8a"
|
140
140
|
}
|
141
141
|
],
|
@@ -1,94 +1,109 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import 'package:test/test.dart';
|
2
|
+
import 'package:raindrops/raindrops.dart';
|
3
|
+
|
4
|
+
final Raindrops raindrops = new Raindrops();
|
3
5
|
|
4
|
-
final raindrops = new Raindrops();
|
5
6
|
void main() {
|
6
|
-
group(
|
7
|
-
group(
|
8
|
-
group(
|
9
|
-
group(
|
7
|
+
group('identity tests', identityTests);
|
8
|
+
group('factor tests', factorTests);
|
9
|
+
group('multiple factor tests', multipleFactorTests);
|
10
|
+
group('edge case tests', edgeCaseTests);
|
10
11
|
}
|
11
12
|
|
12
13
|
void identityTests() {
|
13
|
-
test(
|
14
|
+
test('the sound for 1 is 1', () {
|
14
15
|
final String result = raindrops.convert(1);
|
15
|
-
expect(result, equals(
|
16
|
+
expect(result, equals('1'));
|
16
17
|
}, skip: false);
|
17
|
-
|
18
|
+
|
19
|
+
test('the sound for 3 is Pling', () {
|
18
20
|
final String result = raindrops.convert(3);
|
19
|
-
expect(result, equals(
|
21
|
+
expect(result, equals('Pling'));
|
20
22
|
}, skip: true);
|
21
|
-
|
23
|
+
|
24
|
+
test('the sound for 5 is Plang', () {
|
22
25
|
final String result = raindrops.convert(5);
|
23
|
-
expect(result, equals(
|
26
|
+
expect(result, equals('Plang'));
|
24
27
|
}, skip: true);
|
25
|
-
|
28
|
+
|
29
|
+
test('the sound for 7 is Plong', () {
|
26
30
|
final String result = raindrops.convert(7);
|
27
|
-
expect(result, equals(
|
31
|
+
expect(result, equals('Plong'));
|
28
32
|
}, skip: true);
|
29
33
|
}
|
30
34
|
|
31
35
|
void factorTests() {
|
32
|
-
test(
|
36
|
+
test('the sound for 6 is Pling as it has a factor 3', () {
|
33
37
|
final String result = raindrops.convert(6);
|
34
|
-
expect(result, equals(
|
38
|
+
expect(result, equals('Pling'));
|
35
39
|
}, skip: true);
|
36
|
-
|
40
|
+
|
41
|
+
test('2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base', () {
|
37
42
|
final String result = raindrops.convert(8);
|
38
|
-
expect(result, equals(
|
43
|
+
expect(result, equals('8'));
|
39
44
|
}, skip: true);
|
40
|
-
|
45
|
+
|
46
|
+
test('the sound for 9 is Pling as it has a factor 3', () {
|
41
47
|
final String result = raindrops.convert(9);
|
42
|
-
expect(result, equals(
|
48
|
+
expect(result, equals('Pling'));
|
43
49
|
}, skip: true);
|
44
|
-
|
50
|
+
|
51
|
+
test('the sound for 10 is Plang as it has a factor 5', () {
|
45
52
|
final String result = raindrops.convert(10);
|
46
|
-
expect(result, equals(
|
53
|
+
expect(result, equals('Plang'));
|
47
54
|
}, skip: true);
|
48
|
-
|
55
|
+
|
56
|
+
test('the sound for 14 is Plong as it has a factor of 7', () {
|
49
57
|
final String result = raindrops.convert(14);
|
50
|
-
expect(result, equals(
|
58
|
+
expect(result, equals('Plong'));
|
51
59
|
}, skip: true);
|
52
60
|
}
|
53
61
|
|
54
62
|
void multipleFactorTests() {
|
55
|
-
test(
|
63
|
+
test('the sound for 15 is PlingPlang as it has factors 3 and 5', () {
|
56
64
|
final String result = raindrops.convert(15);
|
57
|
-
expect(result, equals(
|
65
|
+
expect(result, equals('PlingPlang'));
|
58
66
|
}, skip: true);
|
59
|
-
|
67
|
+
|
68
|
+
test('the sound for 21 is PlingPlong as it has factors 3 and 7', () {
|
60
69
|
final String result = raindrops.convert(21);
|
61
|
-
expect(result, equals(
|
70
|
+
expect(result, equals('PlingPlong'));
|
62
71
|
}, skip: true);
|
63
|
-
|
72
|
+
|
73
|
+
test('the sound for 35 is PlangPlong as it has factors 5 and 7', () {
|
64
74
|
final String result = raindrops.convert(35);
|
65
|
-
expect(result, equals(
|
75
|
+
expect(result, equals('PlangPlong'));
|
66
76
|
}, skip: true);
|
67
77
|
}
|
68
78
|
|
69
79
|
void edgeCaseTests() {
|
70
|
-
test(
|
80
|
+
test('the sound for 25 is Plang as it has a factor 5', () {
|
71
81
|
final String result = raindrops.convert(25);
|
72
|
-
expect(result, equals(
|
82
|
+
expect(result, equals('Plang'));
|
73
83
|
}, skip: true);
|
74
|
-
|
84
|
+
|
85
|
+
test('the sound for 27 is Pling as it has a factor 3', () {
|
75
86
|
final String result = raindrops.convert(27);
|
76
|
-
expect(result, equals(
|
87
|
+
expect(result, equals('Pling'));
|
77
88
|
}, skip: true);
|
78
|
-
|
89
|
+
|
90
|
+
test('the sound for 49 is Plong as it has a factor 7', () {
|
79
91
|
final String result = raindrops.convert(49);
|
80
|
-
expect(result, equals(
|
92
|
+
expect(result, equals('Plong'));
|
81
93
|
}, skip: true);
|
82
|
-
|
94
|
+
|
95
|
+
test('the sound for 52 is 52', () {
|
83
96
|
final String result = raindrops.convert(52);
|
84
|
-
expect(result, equals(
|
97
|
+
expect(result, equals('52'));
|
85
98
|
}, skip: true);
|
86
|
-
|
99
|
+
|
100
|
+
test('the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7', () {
|
87
101
|
final String result = raindrops.convert(105);
|
88
|
-
expect(result, equals(
|
102
|
+
expect(result, equals('PlingPlangPlong'));
|
89
103
|
}, skip: true);
|
90
|
-
|
91
|
-
|
92
|
-
|
104
|
+
|
105
|
+
test('the sound for 3125 is Plang as it has a factor 5', () {
|
106
|
+
final String result = raindrops.convert(3125);
|
107
|
+
expect(result, equals('Plang'));
|
93
108
|
}, skip: true);
|
94
109
|
}
|
@@ -1,48 +1,41 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import 'package:test/test.dart';
|
2
|
+
import 'package:rna_transcription/rna_transcription.dart';
|
3
3
|
|
4
4
|
void main() {
|
5
|
-
final rnaTranscription = new RnaTranscription();
|
6
|
-
|
7
|
-
group(
|
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
|
-
expect(() => rnaTranscription.toRna("XXX"), throwsArgumentError);
|
41
|
-
}, skip: true);
|
42
|
-
|
43
|
-
test("correctly handles partially invalid input", () {
|
44
|
-
expect(() => rnaTranscription.toRna("ACGTXXXCTTAA"), throwsArgumentError);
|
45
|
-
}, skip: true);
|
46
|
-
});
|
5
|
+
final RnaTranscription rnaTranscription = new RnaTranscription();
|
6
|
+
|
7
|
+
group('RnaTranscription', () {
|
8
|
+
test('transcribes cytosine to guanine', () {
|
9
|
+
final String result = rnaTranscription.toRna('C');
|
10
|
+
expect(result, equals('G'));
|
11
|
+
}, skip: false);
|
12
|
+
|
13
|
+
test('transcribes guanine to cytosine', () {
|
14
|
+
final String result = rnaTranscription.toRna('G');
|
15
|
+
expect(result, equals('C'));
|
16
|
+
}, skip: true);
|
17
|
+
|
18
|
+
test('transcribes adenine to uracil', () {
|
19
|
+
final String result = rnaTranscription.toRna('A');
|
20
|
+
expect(result, equals('U'));
|
21
|
+
}, skip: true);
|
22
|
+
|
23
|
+
test('transcribes thymine to adenine', () {
|
24
|
+
final String result = rnaTranscription.toRna('T');
|
25
|
+
expect(result, equals('A'));
|
26
|
+
}, skip: true);
|
27
|
+
|
28
|
+
test('transcribes all dna nucleotides to their rna complements', () {
|
29
|
+
final String result = rnaTranscription.toRna('ACGTGGTCTTAA');
|
30
|
+
expect(result, equals('UGCACCAGAAUU'));
|
31
|
+
}, skip: true);
|
32
|
+
|
33
|
+
test('correctly handles completely invalid input', () {
|
34
|
+
expect(() => rnaTranscription.toRna('XXX'), throwsArgumentError);
|
35
|
+
}, skip: true);
|
36
|
+
|
37
|
+
test('correctly handles partially invalid input', () {
|
38
|
+
expect(() => rnaTranscription.toRna('ACGTXXXCTTAA'), throwsArgumentError);
|
39
|
+
}, skip: true);
|
47
40
|
});
|
48
41
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module GoCounting
|
2
2
|
|
3
|
-
type
|
3
|
+
type Owner = None | Black | White
|
4
4
|
type Coord = int * int
|
5
|
-
type Board =
|
5
|
+
type Board = Owner [,]
|
6
6
|
|
7
|
-
let
|
7
|
+
let charToOwner =
|
8
8
|
function
|
9
|
-
| 'B' ->
|
10
|
-
| 'W' ->
|
9
|
+
| 'B' -> Black
|
10
|
+
| 'W' -> White
|
11
11
|
| _ -> None
|
12
12
|
|
13
13
|
let cols (board: Board) = board.GetUpperBound 0 + 1
|
@@ -44,17 +44,17 @@ let mkBoard (input: string list) =
|
|
44
44
|
let rows = input.Length
|
45
45
|
let cols = input.[0].Length
|
46
46
|
|
47
|
-
Array2D.init cols rows (fun col row ->
|
47
|
+
Array2D.init cols rows (fun col row -> charToOwner input.[row].[col])
|
48
48
|
|
49
49
|
let territoryOwner (board: Board) (coords: Set<Coord>) =
|
50
50
|
let uniqueNeighborColors =
|
51
51
|
coords
|
52
52
|
|> Seq.collect (nonEmptyNeighborCoordinates board)
|
53
|
-
|> Seq.
|
53
|
+
|> Seq.map (color board)
|
54
54
|
|> set
|
55
55
|
|
56
|
-
if uniqueNeighborColors.Count = 1 then
|
57
|
-
else None
|
56
|
+
if uniqueNeighborColors.Count = 1 then Seq.head uniqueNeighborColors
|
57
|
+
else Owner.None
|
58
58
|
|
59
59
|
let rec territoryHelper board remainder acc =
|
60
60
|
match remainder with
|
@@ -72,28 +72,32 @@ let rec territoryHelper board remainder acc =
|
|
72
72
|
|
73
73
|
territoryHelper board newRemainder newAcc
|
74
74
|
|
75
|
-
let
|
75
|
+
let territoryCoordinates board coord =
|
76
76
|
if isValidCoordinate board coord && isEmpty board coord then territoryHelper board [coord] (Set.singleton coord)
|
77
77
|
else Set.empty
|
78
78
|
|
79
|
-
let
|
79
|
+
let territory input coordinate =
|
80
80
|
let board = mkBoard input
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
|
82
|
+
if not (isValidCoordinate board coordinate) then
|
83
|
+
Option.None
|
84
|
+
else
|
85
|
+
let coords = territoryCoordinates board coordinate
|
86
|
+
let owner = territoryOwner board coords
|
87
|
+
Some (owner, Set.toList coords)
|
85
88
|
|
86
89
|
let rec territoriesHelper board remainder acc =
|
87
90
|
match remainder with
|
88
91
|
| [] -> acc
|
89
92
|
| coord :: _ ->
|
90
|
-
let coords =
|
93
|
+
let coords = territoryCoordinates board coord
|
91
94
|
let owner = territoryOwner board coords
|
92
|
-
let remainder = Set.difference (Set.ofList remainder) coords |> Set.toList
|
93
|
-
|
94
|
-
territoriesHelper board remainder (Map.add owner
|
95
|
+
let remainder = Set.difference (Set.ofList remainder) coords |> Set.toList
|
96
|
+
let updatedOwnedTerritories = Map.find owner acc @ Set.toList coords
|
97
|
+
territoriesHelper board remainder (Map.add owner updatedOwnedTerritories acc)
|
95
98
|
|
96
99
|
let territories input =
|
97
100
|
let board = mkBoard input
|
98
101
|
let emptyCoords = emptyCoordinates board
|
99
|
-
|
102
|
+
let startMap = Map.ofList [(Owner.None, []); (Owner.Black, []); (Owner.White, [])]
|
103
|
+
territoriesHelper board emptyCoords startMap
|