             (let [v (get-in hm [x y] 0)]
               (if (> v 0) (inc count) count)))
           0 coords))                              
-;   
-; (defn improved-round
-;   [hm all-coords]
-;   (r/fold (fn [acc [x y neighbours]]
-;             (let [n (count-pos-coords neighbours hm)]
-;               (update-in acc [x y] #(if (= % 0) (+ % n) (+ % n 1)))))
-;           hm
-;           all-coords))
-;           
-          
-(defn improved-round
+
+(defn round
   [hm all-coords]
   (reduce (fn [acc [x y neighbours]]
             (let [n (count-pos-coords neighbours hm)]

          all-coords))


(defn improved-head-map
  [width height coords rounds]
  (let [all-coords (all-coords-with-neighbours width height)]
    (loop [hm (init-positions (init-vec-2d width height 0) coords)
           r rounds]
      (if (= r 0) 
        hm
        (recur (improved-round hm all-coords) (dec r)))))
  "done")

(def coords
  [[1 1]
   [3 3]
   [8 8]])
; 
; (defn normalize-hm
;   [img]
;   (let [min-v (min img)
;         max-v (max img)]
;     (map #(/ (- % min-v) (- max-v min-v)) img)))
;     
; (def hm-img (new-image 200 200))
; 
; (def hm-pixels (get-pixels hm-img))
; 
; (for [i (range 0 (count hm-pixels))]
;   (aset hm-pixels i (rgb (nth normalized-img i) 0 0)))
; 
; (set-pixels hm-img hm-pixels)
; 
; (show hm-img :zoom 2.0 :title "Isn't it beautiful?")


; (defn test-hm-creation
;   [width height coords rounds]

(ns ux-analyzer.heat-map
  (:use [mikera.image.core]
        [mikera.image.colours]
        [mikera.image.spectrum])
  (:import [Math])
  (:require [clojure.core.reducers :as r]))

