 (ns playwood-logo.core
-    (:require [reagent.core :as reagent :refer [atom]]))
+  (:require [reagent.core :as reagent :refer [atom]]))
 
 (enable-console-print!)
 

  ;; optionally touch your app-state to force rerendering depending on
  ;; your application
  ;; (swap! app-state update-in [:__figwheel_counter] inc)
)

        num-cols (:num-cols grid)]
    [:svg {:width width
           :height height}
     [:g {:transform
          (str "scale(" (/ width num-rows) "," (/ height num-cols) ")")}
      (for [x (range num-rows)]
        (for [y (range num-cols)]
          [Cell {:key (str x ":" y) :x x :y y}]
          ))
      [Turtle (:turtle @app-state)]
      ]
     ]))


(defn controls []
  [:div {:style {
                 :display "flex" :flex-direction "column" :align-items "center"
                 }}
   [:div {:style {:padding 5}}
    (case (-> @app-state :program :mode)
      :play [:button {:on-click stop! } "Stop"]
      :stop [:button {:on-click play! } "Play"])
    [:button {:on-click reset-turtle! } "Reset"]]
   [:textarea {
               :style { :font-family "monospace" :width 400 :height 300 }
               :value (-> @app-state :program :code (#(apply str %)))} ]

   [:div  "Step: " (-> @app-state :program :step)]
   ])


(defn world []
  [:div {:style { :display "flex" :flex-direction "column" }}
   [Board]
   [controls]
   ])


