Skip to content

Instantly share code, notes, and snippets.

@scientific-coder
Last active October 7, 2018 15:27
Show Gist options
  • Save scientific-coder/175556a3205f5d7e6105605994024687 to your computer and use it in GitHub Desktop.
Save scientific-coder/175556a3205f5d7e6105605994024687 to your computer and use it in GitHub Desktop.
Parsing some scala code to svg for Kingdomino deck updated for formatting, thx!
(ns kingdomino.core
(:require [instaparse.core :as insta])
(:gen-class))
(def size 100)
(def delta-sides 5)
(def ncols 2)
(def delta-dominos 10)
(def colors {:clay "#cc6600" :field "#ffff66" :water "#33ccff" :pasture "#00cc00" :forest "#669900" :mine "#5c5c3d"})
(def domino-parser
(instaparse.core/parser
"DECK= ((DOMINO | <LINE_COMMENT> | <BLOCK_COMMENT>) / <USELESS>)*
LINE_COMMENT= '//' #'[^\n]*'
BLOCK_COMMENT= '/*' INSIDE_COMMENT* '*/'
INSIDE_COMMENT= !( '*/' | '/*' ) #'.'| '\n' | BLOCK_COMMENT
DOMINO= <'Domino'> <SPACES>? <'('> <SPACES>? DOMINO_NUMBER <SPACES>? <','> <SPACES>? TILE <SPACES>? <','> <SPACES>? TILE <SPACES>? <')'>
DOMINO_NUMBER= NUMBER
TILE= <'Tile'> <SPACES>? <'('> <SPACES>? TERRAIN <SPACES>? ( <','> <SPACES>? CASTLES_NUMBER <SPACES>?)? <')'>
CASTLES_NUMBER= NUMBER
TERRAIN= 'Forest' | 'Water' |'Pasture'|'Clay'|'Field'|'Mine'
<USELESS>= #'.' | '\n'
NUMBER= #'-?[0-9]+'
<SPACES> = #'\\s+'"))
(defn tile
([type] (tile type ""))
([type castles]
(str "<path d=\"m" size " 0 l-" size " 0 l0 " size " l" size " 0 \" fill=\"" (type colors) "\"/>\n"
castles)))
(defn translate [[x y] s]
(str "<svg x=\"" x "\" y=\"" y "\">\n" s "</svg>\n"))
(defn back [id]
(let [length (* 2 size)]
(str "<path d=\"m" length " 0 l-" length " 0 l0 " size " l" length
" 0 \" fill=\"black\"/>\n" "<text x=\"" size "\" y=\"" (/ size 2)
"\" fill=\"white\" stroke=\"grey\" text-anchor= \"middle\""
" font-size= \"48\">" id "</text>\n")))
(defn rotate [a [x y]]
(let [[c s] [(Math/cos a) (Math/sin a)]]
[(- (* c x) (* s y)) (+ (* s x) (* c y))]))
(defn castles [n]
(let [c (/ size 2)
r (/ size 10)
castle (str "<circle cx=\"" c "\" cy=\"" c "\" r=\"" r "\" stroke=\"black\" "
"stroke-width=\"3\" fill=\"red\" />")
v [(/ size 5) 0]]
(->> (range n)
(map #(translate (rotate (/ (* 2 Math/PI %) n) v)
castle))
(apply str))))
(defn domino [back tile1 tile2]
(str back
(translate [(+ (* 2 size) delta-sides) 0]
(str tile1 (translate [size 0] tile2)))))
(defn deck [& dominos]
(let [dx (+ delta-dominos (* 4 size) delta-sides)
dy (+ delta-dominos size)
grid-placement (fn [i d]
(let [x (rem i ncols)
y (quot i ncols)]
(translate [(* x dx) (* y dy)] d)))
dominos (->> dominos (map-indexed grid-placement) (apply str))
w (* dx ncols)
h (* dy (quot (count dominos) ncols))]
(str "<svg version=\"1.1\" baseProfile=\"full\" xmlns=\"http://www.w3.org/2000/svg\">\n"
"<svg height=\"" h "\" width=\"" w "\">"
dominos
"</svg>\n"
"</svg>\n")))
(defn -main
"reads scala code constructing a deck of dominos and output the svg"
[& [input output]]
(->> (or input *in*) slurp (insta/parse domino-parser)
(insta/transform {:NUMBER #(Long/parseLong %)
:CASTLES_NUMBER castles
:TILE tile
:DOMINO_NUMBER back
:DOMINO domino
:TERRAIN (comp keyword clojure.string/lower-case)
:DECK deck})
(spit (or output *out*))))
;; lein uberjar
;; java -jar target/uberjar/kingdomino-0.1.0-SNAPSHOT-standalone.jar https://raw.githubusercontent.com/mratin/kdom/master/src/main/scala/se/apogo/kdom/Domino.scala output.svg
Display the source blob
Display the rendered blob
Raw
<svg version="1.1"
baseProfile="full"
xmlns="http://www.w3.org/2000/svg">
<svg height="2640" width="830"><svg x="0" y="0">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">1</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="415" y="0">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">2</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="0" y="110">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">3</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="415" y="110">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">4</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="0" y="220">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">5</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="415" y="220">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">6</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="0" y="330">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">7</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="415" y="330">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">8</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="0" y="440">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">9</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="415" y="440">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">10</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0</svg>
</svg>
</svg>
<svg x="0" y="550">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">11</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0</svg>
</svg>
</svg>
<svg x="415" y="550">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">12</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
0</svg>
</svg>
</svg>
<svg x="0" y="660">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">13</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="415" y="660">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">14</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="0" y="770">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">15</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0</svg>
</svg>
</svg>
<svg x="415" y="770">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">16</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
0</svg>
</svg>
</svg>
<svg x="0" y="880">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">17</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="415" y="880">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">18</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0</svg>
</svg>
</svg>
<svg x="0" y="990">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">19</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="415" y="990">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">20</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1100">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">21</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1100">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">22</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1210">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">23</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#5c5c3d"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1210">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">24</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1320">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">25</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1320">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">26</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1430">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">27</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1430">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">28</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1540">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">29</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1540">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">30</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1650">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">31</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1650">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">32</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1760">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">33</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1760">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">34</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="0" y="1870">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">35</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#669900"/>
0</svg>
</svg>
</svg>
<svg x="415" y="1870">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">36</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="0" y="1980">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">37</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="415" y="1980">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">38</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="0" y="2090">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">39</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="415" y="2090">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">40</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#5c5c3d"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="0" y="2200">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">41</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="415" y="2200">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">42</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#33ccff"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="0" y="2310">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">43</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="415" y="2310">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">44</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#00cc00"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="0" y="2420">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">45</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#5c5c3d"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0</svg>
</svg>
</svg>
<svg x="415" y="2420">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">46</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#5c5c3d"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="0" y="2530">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">47</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#cc6600"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#5c5c3d"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-20.0" y="2.4492935982947065E-15">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
<svg x="415" y="2530">
<path d="m200 0 l-200 0 l0 100 l200 0 " fill="black"/>
<text x="100" y="50" fill="white" stroke="grey" text-anchor= "middle" font-size= "48">48</text>
<svg x="205" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#ffff66"/>
0<svg x="100" y="0">
<path d="m100 0 l-100 0 l0 100 l100 0 " fill="#5c5c3d"/>
<svg x="20.0" y="0.0">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-9.999999999999996" y="17.320508075688775">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
<svg x="-10.000000000000009" y="-17.32050807568877">
<circle cx="50" cy="50" r="10" stroke="black" stroke-width="3" fill="red" /></svg>
</svg>
</svg>
</svg>
</svg>
</svg>
package se.apogo.kdom
case class Domino(number: Int, tile1: Tile, tile2: Tile) {
}
// Domino(300, Tile(Field), Tile(Field)),
// Domino(330, Tile(Field), Tile(Field)),Domino(330, Tile(Field), Tile(Field)),
/*
Domino(200, Tile(Field), Tile(Field)),
Domino(220, Tile(Field), Tile(Field)), Domino(220, Tile(Field), Tile(Field)),
*/
object Domino {
val allDominoes: Seq[Domino] = Seq(
Domino(1,
Tile(Field),
Tile(Field)),
Domino(2, Tile(Field), Tile(Field)),
Domino(3, Tile(Forest), Tile(Forest)),
Domino(4, Tile(Forest), Tile(Forest)),
Domino(5, Tile(Forest), Tile(Forest)),
Domino(6,
Tile(Forest),
Tile(Forest)),
Domino(7, Tile(Water), Tile(Water)),
Domino(8,
Tile(Water), Tile(Water)),
Domino(9, Tile(Water), Tile(Water)),
Domino(10, Tile(Pasture), Tile(Pasture)),
Domino(11, Tile(Pasture), Tile(Pasture)),
Domino(12, Tile(Clay), Tile(Clay)),
Domino(13, Tile(Field), Tile(Forest)),
Domino(14, Tile(Field), Tile(Water)),
Domino(15, Tile(Field), Tile(Pasture)),
Domino(16, Tile(Field), Tile(Clay)),
Domino(17, Tile(Forest), Tile(Water)),
Domino(18, Tile(Forest), Tile(Pasture)),
Domino(19, Tile(Field, 1), Tile(Forest)),
Domino(20, Tile(Field, 1), Tile(Water)),
Domino(21, Tile(Field, 1), Tile(Pasture)),
Domino(22, Tile(Field, 1), Tile(Clay)),
Domino(23, Tile(Field, 1), Tile(Mine)),
Domino(24, Tile(Forest, 1), Tile(Field)),
Domino(25, Tile(Forest, 1), Tile(Field)),
Domino(26, Tile(Forest, 1), Tile(Field)), // Domino(400, Tile(Field), Tile(Field)),
Domino(27, Tile(
Forest
,
1
) ,
Tile
(
Field
)
)
,
Domino(28, Tile(Forest, 1), Tile(Water)),
Domino(29, Tile(Forest, 1), Tile(Pasture)),
Domino(30, Tile(Water, 1), Tile(Field)),
Domino(31, Tile(Water, 1), Tile(Field)),
Domino(32, Tile(Water, 1), Tile(Forest)),
Domino(33, Tile(Water, 1), Tile(Forest)),
Domino(34, Tile(Water, 1), Tile(Forest)),
Domino(35, Tile(Water, 1), Tile(Forest)),
Domino(36, Tile(Field), Tile(Pasture, 1)),
Domino(37, Tile(Water), Tile(Pasture, 1)),
Domino(38, Tile(Field), Tile(Clay, 1)),
Domino(39, Tile(Pasture), Tile(Clay, 1)),
Domino(40, Tile(Mine, 1), Tile(Field)),
Domino(41, Tile(Field), Tile(Pasture, 2)),
Domino(42, Tile(Water), Tile(Pasture, 2)),
Domino(43, Tile(Field), Tile(Clay, 2)),
Domino(44, Tile(Pasture), Tile(Clay, 2)),
Domino(45, Tile(Mine, 2), Tile(Field)),
Domino(46, Tile(Clay), Tile(Mine, 2)),
Domino(47, Tile(Clay), Tile(Mine, 2)),/* Domino(500, Tile(Field), Tile(Field)), */
Domino(48, Tile(Field), Tile(Mine, 3))
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment