November 27, 2016

Daily programmer - saturday defusal

Right of the way gonna say that doing it on Saturday just because didn’t feel like doing it at all. This task is based on Mondays one and consists of two parts. Task is here, latest solution is here. So with regular task I came pretty quickly and there is really nothing special comparing with easy one. (def wire-rules {:s0 {\w :s1, \r :s2} :s1 {\w :s2, \o :s3} :s2 {\b :s3, \r :s0} :s3 {\b :s3, \o :s4, \g :s5} :s4 {\g :exit} :s5 {\o :exit}}) (defn end? ... Read more

November 21, 2016

Daily programmer (easy Monday)

Another easy Monday except this one is little bit more easy than last one. Here is the task. I finished rather fast with initial version, but doing little changes for of times I’ve ended up with this. (ns daily-programmer.20161121_easy.core (:use [clojure.string :only [split-lines]])) (def wire-rules-m {"white" {:to-cut #{} :not-to-cut #{"white" "black"}} "red" {:to-cut #{"green"} :not-to-cut #{}} "black" {:to-cut #{} :not-to-cut #{"white" "green" "orange"}} "orange" {:to-cut #{"red" "black"} :not-to-cut #{}} "green" {:to-cut #{"orange" "white"} :not-to-cut #{}} "purple" {:to-cut #{} :not-to-cut #{"purple" "green" "orange" "white"}}}) (defn can-cut? ... Read more

November 17, 2016

Daily programmer (easy Monday)

Since this is first post on daily-programmer topic I need some introduction. So there is this awesome sub reddit called DailyProgrammer where programming tasks on algorithms are posted 3 times a week. Easy ones on Mondays, intermedium ones on Tuesdays and hard ones on Friday. You can post Your solutions in favorite language and compile and test them directly in the comment section with /u/CompileBot. I’ve been aware about this thing for already quite some time but never was able to stick with it for too long. ... Read more

© Andrii Ursulenko 2016