Fixed water level rendering bug.
[microbotany.git] / garden.scm
index 1bd504b..3664612 100644 (file)
@@ -5,7 +5,9 @@
         (chicken io)
         (chicken string)
         (chicken format)
-        srfi-1)
+        (chicken file)
+        (chicken condition)
+        srfi-1 uri-common simple-sha1)
 
 (define rand-double pseudo-random-real)
 
@@ -84,7 +86,7 @@
     (if last-watered
         (let* ((now (current-seconds))
                (1day (* 24 3600))
-               (remaining-pc (quotient (* 100 (- 1day (- now last-watered))) 1day))
+               (remaining-pc (quotient (* 100 (max 0 (- 1day (- now last-watered)))) 1day))
                (filled (quotient remaining-pc 4))
                (unfilled (- 25 filled)))
           (print "["