Commit 53091f10 authored by Davide Taviani's avatar Davide Taviani

moved board to cljc + format css

parent 977c41a2
......@@ -16,7 +16,7 @@
:plugins [[lein-cljsbuild "1.1.6"]]
:source-paths ["src/clj" "src/cljs"]
:source-paths ["src/clj" "src/cljs" "src/cljc"]
:test-paths ["test/clj" "test/cljs"]
:resource-paths ["resources"]
......
.board { border: 1px solid #DDD; margin: 50px;}
.board {
border: 1px solid #DDD;
margin: 50px;
width: 400px;
}
.row {
margin-bottom: -7px;
}
......@@ -6,27 +10,49 @@ margin-bottom: -7px;
display: inline;
margin-right: -1px;
}
.create-board {border: 0;}
.create-board .cell {border: 1px solid #DDD;
//margin: 0px;}
.create-board {
border: 0;
}
.create-board .cell {
border: 1px solid #DDD;
//margin: 0px;
}
.rotate-1 { transform: rotate(90deg);}
.rotate-2 { transform: rotate(180deg);}
.rotate-3 { transform: rotate(270deg);}
.notification { height: 100px;
.notification {
height: 100px;
padding:0;
display:flex;
align-items:center;
justify-content: center;}
justify-content: center;
}
.board-controls {
display:flex;
align-items:center;
justify-content: center;}
.is-blank {background-color: white;}
justify-content: center;
}
.is-blank {
background-color: white;
}
.btn-create {margin: 5px;}
.btn-create {
margin: 5px;
}
.has-centered-stuff {
display:flex;
align-items:center;
justify-content: center;}
\ No newline at end of file
justify-content: center;
}
.fill-block {
display: inline-block;
width: 20px;
height: 20px;
background-color: black;
}
\ No newline at end of file
......@@ -35,7 +35,7 @@
(GET "/play/:level-id" {{:keys [level-id]} :params}
(html-utils/spa-page (db/query-level (UUID/fromString level-id)) "harmony.core.render_play();"))
(GET "/new" [] (html-utils/spa-page {} "harmony.core.render_new();"))
(POST "/delete/:level-id" {{:keys [level-id]} :params}
#_(POST "/delete/:level-id" {{:keys [level-id]} :params}
(let [level (db/query-level (UUID/fromString level-id))]
(when level
(when (db/delete! level)
......
......@@ -5,7 +5,6 @@
:pattern [1]})
(defn tile [n-set value]
(case (count n-set)
4 :4-tile
......@@ -78,7 +77,7 @@
#{:E} #{1}
#{:S} #{2}
#{:W} #{3}
#{} #{0 1 2 3}}) ;
#{} #{0 1 2 3}})
(defn solve [board]
......@@ -93,4 +92,16 @@
(:status cell)))
(defn correct? [board]
(every? correct-position? (:cells board)))
\ No newline at end of file
(every? correct-position? (:cells board)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; rather than defining a sparsity pattern, we construct 2 link matrices, one for the rows and one for the columns
;; Row link matrix: N-1 x N : a_{i,j} means: Tiles t_{i,j} and t_{i,j+1} are connected
;; Column link matrix: N x N-1 : a_{i,j} means: Tiles t_{i,j} and t_{i+1,j} are connected
(def board-links
{:size 2
:row-links [1 0]
:column-links [0 1]})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment