trackler 2.2.1.140 → 2.2.1.141
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/clojure/appveyor.yml +11 -0
- data/tracks/clojure/config.json +8 -0
- data/tracks/clojure/exercises/dominoes/README.md +16 -0
- data/tracks/clojure/exercises/dominoes/project.clj +4 -0
- data/tracks/clojure/exercises/dominoes/src/dominoes.clj +3 -0
- data/tracks/clojure/exercises/dominoes/src/example.clj +20 -0
- data/tracks/clojure/exercises/dominoes/test/dominoes_test.clj +39 -0
- data/tracks/clojure/exercises/minesweeper/test/minesweeper_test.clj +12 -10
- data/tracks/coq/docs/LEARNING.md +10 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7cf22fee63634a6ddbb2c0ff044ad5174d22bb7
|
4
|
+
data.tar.gz: e209001452daff690ba4dfc7f29b8c0c11284e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74402845d18b577782f1ee514fd96b9da9996d9ef680713b5cc8e9adb283d76549be3393b6637f11111a7ccf3790b99f7d26382de41c729fe61a8b870979e2b4
|
7
|
+
data.tar.gz: 1f4d3162f330135563701b4922da64abcb28a65764e16444f702e5dc21c4a5c58710a5ab6e30a3a6c7a563fc30a35cdde0154175ce59b4fdbe606da7aa85ea5c
|
data/lib/trackler/version.rb
CHANGED
data/tracks/clojure/config.json
CHANGED
@@ -597,6 +597,14 @@
|
|
597
597
|
"topics": null,
|
598
598
|
"unlocked_by": null,
|
599
599
|
"uuid": "7df7ff1c-74ab-4f4e-aaf0-257b6e1cbc18"
|
600
|
+
},
|
601
|
+
{
|
602
|
+
"core": false,
|
603
|
+
"difficulty": 1,
|
604
|
+
"slug": "dominoes",
|
605
|
+
"topics": null,
|
606
|
+
"unlocked_by": null,
|
607
|
+
"uuid": "db6162c0-adff-401e-9dd6-a0322ca10dcf"
|
600
608
|
}
|
601
609
|
],
|
602
610
|
"foregone": [],
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Make a chain of dominoes.
|
2
|
+
|
3
|
+
Compute a way to order a given set of dominoes in such a way that they form a
|
4
|
+
correct domino chain (the dots on one half of a stone match the dots on the
|
5
|
+
neighbouring half of an adjacent stone) and that dots on the halfs of the stones
|
6
|
+
which don't have a neighbour (the first and last stone) match each other.
|
7
|
+
|
8
|
+
For example given the stones `[2|1]`, `[2|3]` and `[1|3]` you should compute something
|
9
|
+
like `[1|2] [2|3] [3|1]` or `[3|2] [2|1] [1|3]` or `[1|3] [3|2] [2|1]` etc, where the first and last numbers are the same.
|
10
|
+
|
11
|
+
For stones `[1|2]`, `[4|1]` and `[2|3]` the resulting chain is not valid: `[4|1] [1|2] [2|3]`'s first and last numbers are not the same. 4 != 3
|
12
|
+
|
13
|
+
Some test cases may use duplicate stones in a chain solution, assume that multiple Domino sets are being used.
|
14
|
+
|
15
|
+
## Submitting Incomplete Solutions
|
16
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
(ns dominoes)
|
2
|
+
|
3
|
+
(defn rm [xs x]
|
4
|
+
(let [i (.indexOf xs x)]
|
5
|
+
(if (= -1 i) xs (vec (concat (take i xs) (drop (inc i) xs))))))
|
6
|
+
|
7
|
+
(defn connects [[a b] [c d]]
|
8
|
+
(cond (= b c) [c d]
|
9
|
+
(= b d) [d c]
|
10
|
+
:else nil))
|
11
|
+
|
12
|
+
(defn backtrack [rem chain]
|
13
|
+
(or (and (empty? rem) (= (ffirst chain) (second (peek chain))))
|
14
|
+
(and (not (empty? rem))
|
15
|
+
(some #(let [c (connects (peek chain) %)]
|
16
|
+
(and c (backtrack (rm rem %) (conj chain c))))
|
17
|
+
rem))))
|
18
|
+
|
19
|
+
(defn can-chain? [xs]
|
20
|
+
(or (empty? xs) (some #(backtrack (rm xs %) [%]) xs)))
|
@@ -0,0 +1,39 @@
|
|
1
|
+
(ns dominoes-test
|
2
|
+
(:require [clojure.test :refer [deftest is]]
|
3
|
+
[dominoes :refer [can-chain?]]))
|
4
|
+
|
5
|
+
(deftest empty-input-empty-output
|
6
|
+
(is (can-chain? [])))
|
7
|
+
|
8
|
+
(deftest singleton-input-singleton-output
|
9
|
+
(is (can-chain? [[1 1]])))
|
10
|
+
|
11
|
+
(deftest singleton-that-cant-be-chained
|
12
|
+
(is ((comp not can-chain?) [[1 2]])))
|
13
|
+
|
14
|
+
(deftest three-elements
|
15
|
+
(is (can-chain? [[1 2] [3 1] [2 3]])))
|
16
|
+
|
17
|
+
(deftest can-reverse-dominoes
|
18
|
+
(is (can-chain? [[1 2] [1 3] [2 3]])))
|
19
|
+
|
20
|
+
(deftest cant-be-chained
|
21
|
+
(is ((comp not can-chain?) [[1 2] [4 1] [2 3]])))
|
22
|
+
|
23
|
+
(deftest disconnected-simple
|
24
|
+
(is ((comp not can-chain?) [[1 1] [2 2]])))
|
25
|
+
|
26
|
+
(deftest disconnected-double-loop
|
27
|
+
(is ((comp not can-chain?) [[1 2] [2 1] [3 4] [4 3]])))
|
28
|
+
|
29
|
+
(deftest disconnected-single-isolated
|
30
|
+
(is ((comp not can-chain?) [[1 2] [2 3] [3 1] [4 4]])))
|
31
|
+
|
32
|
+
(deftest need-backtrack
|
33
|
+
(is (can-chain? [[1 2] [2 3] [3 1] [2 4] [2 4]])))
|
34
|
+
|
35
|
+
(deftest separate-loops
|
36
|
+
(is (can-chain? [[1 2] [2 3] [3 1] [1 1] [2 2] [3 3]])))
|
37
|
+
|
38
|
+
(deftest nine-elements
|
39
|
+
(is (can-chain? [[1 2] [5 3] [3 1] [1 2] [2 4] [1 6] [2 3] [3 4] [5 6]])))
|
@@ -3,30 +3,32 @@
|
|
3
3
|
[clojure.string :refer [join]]
|
4
4
|
[minesweeper :refer [draw]]))
|
5
5
|
|
6
|
+
(def line-separator (System/getProperty "line.separator"))
|
7
|
+
|
6
8
|
(deftest zero-size-board
|
7
9
|
(is (= (draw "") "")))
|
8
10
|
|
9
11
|
(deftest empty-board
|
10
|
-
(is (= (draw (join
|
12
|
+
(is (= (draw (join line-separator [" "
|
11
13
|
" "
|
12
14
|
" "]))
|
13
|
-
(join
|
15
|
+
(join line-separator [" "
|
14
16
|
" "
|
15
17
|
" "]))))
|
16
18
|
|
17
19
|
(deftest surrounded
|
18
|
-
(is (= (draw (join
|
20
|
+
(is (= (draw (join line-separator ["***"
|
19
21
|
"* *"
|
20
22
|
"***"]))
|
21
|
-
(join
|
23
|
+
(join line-separator ["***"
|
22
24
|
"*8*"
|
23
25
|
"***"]))))
|
24
26
|
|
25
27
|
(deftest board-full-of-mines
|
26
|
-
(is (= (draw (join
|
28
|
+
(is (= (draw (join line-separator ["***"
|
27
29
|
"***"
|
28
30
|
"***"]))
|
29
|
-
(join
|
31
|
+
(join line-separator ["***"
|
30
32
|
"***"
|
31
33
|
"***"]))))
|
32
34
|
|
@@ -35,24 +37,24 @@
|
|
35
37
|
"1*2*1")))
|
36
38
|
|
37
39
|
(deftest vertical-line
|
38
|
-
(is (= (draw (join
|
40
|
+
(is (= (draw (join line-separator [" "
|
39
41
|
"*"
|
40
42
|
" "
|
41
43
|
"*"
|
42
44
|
" "]))
|
43
|
-
(join
|
45
|
+
(join line-separator ["1"
|
44
46
|
"*"
|
45
47
|
"2"
|
46
48
|
"*"
|
47
49
|
"1"]))))
|
48
50
|
|
49
51
|
(deftest cross
|
50
|
-
(is (= (draw (join
|
52
|
+
(is (= (draw (join line-separator [" * "
|
51
53
|
" * "
|
52
54
|
"*****"
|
53
55
|
" * "
|
54
56
|
" * "]))
|
55
|
-
(join
|
57
|
+
(join line-separator [" 2*2 "
|
56
58
|
"25*52"
|
57
59
|
"*****"
|
58
60
|
"25*52"
|
data/tracks/coq/docs/LEARNING.md
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
Coq is a formal proof management system. It provides a formal language to write mathematical definitions, executable algorithms and theorems together with an environment for semi-interactive development of machine-checked proofs.
|
2
|
+
|
3
|
+
There are some free resources for learning Coq, such as:
|
4
|
+
|
5
|
+
* Software Foundations series:
|
6
|
+
+ [Volume 1: Logical Foundations](https://softwarefoundations.cis.upenn.edu/lf-current/index.html)
|
7
|
+
+ [Volume 2: Programming Language Foundations](https://softwarefoundations.cis.upenn.edu/plf-current/index.html)
|
8
|
+
+ [Volume 3: Verified Functional Algorithms](https://softwarefoundations.cis.upenn.edu/vfa-current/index.html)
|
9
|
+
* Certified Programming with Dependent Types:
|
10
|
+
+ Which is avalaible for free in [Adam Chipala's site](http://adam.chlipala.net/cpdt/).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.1.
|
4
|
+
version: 2.2.1.141
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -1538,6 +1538,7 @@ files:
|
|
1538
1538
|
- tracks/clojure/_src/clock_generator.clj
|
1539
1539
|
- tracks/clojure/_src/generator.clj
|
1540
1540
|
- tracks/clojure/_test/check_exercises.clj
|
1541
|
+
- tracks/clojure/appveyor.yml
|
1541
1542
|
- tracks/clojure/bin/fetch-configlet
|
1542
1543
|
- tracks/clojure/bin/restructure.clj
|
1543
1544
|
- tracks/clojure/config.json
|
@@ -1654,6 +1655,11 @@ files:
|
|
1654
1655
|
- tracks/clojure/exercises/difference-of-squares/src/difference_of_squares.clj
|
1655
1656
|
- tracks/clojure/exercises/difference-of-squares/src/example.clj
|
1656
1657
|
- tracks/clojure/exercises/difference-of-squares/test/difference_of_squares_test.clj
|
1658
|
+
- tracks/clojure/exercises/dominoes/README.md
|
1659
|
+
- tracks/clojure/exercises/dominoes/project.clj
|
1660
|
+
- tracks/clojure/exercises/dominoes/src/dominoes.clj
|
1661
|
+
- tracks/clojure/exercises/dominoes/src/example.clj
|
1662
|
+
- tracks/clojure/exercises/dominoes/test/dominoes_test.clj
|
1657
1663
|
- tracks/clojure/exercises/etl/README.md
|
1658
1664
|
- tracks/clojure/exercises/etl/project.clj
|
1659
1665
|
- tracks/clojure/exercises/etl/src/etl.clj
|