I hereby claim:
- I am macroz on github.
- I am macroz (https://keybase.io/macroz) on keybase.
- I have a public key ASCuYbAOYya7Q5CFpomYzrmKbQd-ssTXxh6pNmQ6KSBzGAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(defn eat [thinker world delta-time] | |
(let [cloud (rand-nth (find-touching-clouds world thinker)) | |
amount (min (:size cloud) | |
(- configuration/life-maximum-size (:size thinker)) | |
(* configuration/life-eat-amount delta-time))] | |
(-> world | |
(update thinker :action "eat") | |
(update thinker :size (+ (:size thinker) amount)) | |
(update cloud :size (- (:size cloud) amount)) | |
))) |
(ns misc.y-tunnus | |
(:use clojure.test) | |
(:import java.lang.Integer)) | |
(defn valid? [code-with-checksum] | |
(when-let [[_ code checksum] (re-find #"(^\d{6,7})-(\d$)" code-with-checksum)] | |
(let [code (if (= 6 (count code)) | |
(str "0" code) | |
code) | |
modulo (mod (->> (map str code) |
(ns dijkstra.core | |
(:require [clojure.string :as string]) | |
(:use [clojure.data.priority-map]) | |
(:use [clojure.test])) | |
(defn dijkstra [start goal?-fn distance-fn neighbors-fn max-depth] | |
(loop [open (priority-map [start [start]] 0) | |
depth 0] |