Great! I look forward to the next one. This website is quite good: http://codingdojo.org/kata/ or this one for the videos?: https://katalyst.codurance.com/browse?query=TDD%20starter or could do exercism: https://exercism.io/my/tracks. Actually my vote would (humbly) be for exercism. I am loving the videos! Thank you so much!
I wondered if I could also ask a question. It was a great session yesterday at Thoughtworks. Our group did Tic Tac in Clojure: https://github.com/TomSpencerLondon/Clojure-Tic-Tac-Toe I am being a bit slow on this code: https://github.com/TomSpencerLondon/Clojure-Tic-Tac-Toe/blob/master/src/tic_tac_toe/core.clj#L16
I understood defn game and defn full-row and first two lines of check. Just wondering about lines 20 and 21 in check method.
@tomspencerlondon from the looks of it, row 20 is passing the diagonal values (top left, middle, bottom right) to the full-row
function, and line 21 is doing the other diagonal (top right, middle, bottom left)
If you imaging your board as:
[[:a1 :a2 :a3]
[:b1 :b2 :b3]
[:c1 :c2 :c3]]
(map #(nth (second %) (first %)) (map-indexed vector [[:a1 :a2 :a3] [:b1 :b2 :b3] [:c1 :c2 :c3]]))
will give you (:a1 :b2 :c3)
and
(map #(nth (second %) (- 2 (first %))) (map-indexed vector [[:a1 :a2 :a3] [:b1 :b2 :b3] [:c1 :c2 :c3]]))
will give you (:a3 :b2 :c1)
Great. Thanks @yogidevbear! Then we call full-row on this result to assess if there is a full vector. This is useful. So that means this one:
(full-row (map #(nth (second %) (- 2 (first %))) (map-indexed vector board)))
is assessing the middle row. Thanks again.No, so my understanding is that that example is assessing the diagonal from top right to bottom left
[[- - x]
[- x -]
[x - -]]
@tomspencerlondon āļø
Oh right. I think Iām getting it.
If I test the following in my repl:
(map #(nth (second %) (- 2 (first %))) (map-indexed vector [[:- :- :x] [:- :x :-] [:x :- :-]]))
I get (:x :x :x)
Cool. Yes. I need to run these properly in the repl.
I always find breaking these things down into their smaller parts and running each this with a tangible example directly in my repl helps to clear up what each individual part is doing
Thanks for the feedback this is helpful!
Wish I'd been able to make it last night. Will hopefully be at the next one though š
Excellent! Look forward to seeing you there!
@tomspencerlondon http://Exercism.io is something I would like to do more with. I also hope to find time to help them with version 3 of their Clojure curriculum and add it to ClojureBridge.