fdcd71c3f6aa

Deunicodeify things, start unfucking animal collisions
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 14 Dec 2015 18:32:51 +0000
parents a3f583b450a2
children a88ac1a9acea
branches/tags (none)
files src/silt/core.clj

Changes

--- a/src/silt/core.clj	Mon Dec 14 18:21:36 2015 +0000
+++ b/src/silt/core.clj	Mon Dec 14 18:32:51 2015 +0000
@@ -136,8 +136,8 @@
                        (rr/rand-nth [:white :blue :green :yellow :red])))
      (update :glyph
              (maybe (or mc 0.01) v
-                    (rr/rand-nth ["♞" "☃" "ℵ" "ℇ" "⧲" "⦼" "⨾" "∂" "∀" "€"
-                                  "₵" "★" "♞" "♟" "❣" "¿" "?" "§" "@"]))))))
+                    (rr/rand-nth [";" "☃" "$" "&" "!" ":" "¥" "£" "¤" "€"
+                                  "‡" "ß" "¶" "µ" "¢" "¬" "¿" "?" "§" "@"]))))))
 
 (defn map-vals [m f]
   (into {} (for [[k v] m]
@@ -150,6 +150,7 @@
   ; eat shit, clojure
   (if (< n 0) (- n) n))
 
+
 ; Mysteries -------------------------------------------------------------------
 (def landmarks
   (ref (to-loc-map
@@ -211,10 +212,14 @@
    (clone animal)])
 
 (defn try-move [orig dir]
-  (let [dest (dir-add orig dir)]
-    (if (contains? @terrain dest)
-      orig
-      dest)))
+  (if (= dir [0 0])
+    orig
+    (let [dest (dir-add orig dir)]
+      (if (or (contains? @terrain dest)
+              (contains? @landmarks dest)
+              (contains? @animals dest))
+        orig
+        dest))))
 
 
 (defn near-water [animal]
@@ -271,8 +276,7 @@
     try-reproduce))
 
 (defn tick-animals [animals]
-  (into {} (map (juxt :loc identity)
-                (mapcat tick-animal (vals animals)))))
+  (to-loc-map (mapcat tick-animal (vals animals))))
 
 
 ; World Generation ------------------------------------------------------------