X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=microbotany.git;a=blobdiff_plain;f=garden.scm;h=3664612b35e3d16cd9a5fa4d136ea4bb8268b408;hp=ac8f4ebef370e5f83b168ad5d2e09cd17d0f9f4c;hb=HEAD;hpb=603c9be4154b10f0c7d07a402d3f684dd1fd6b46 diff --git a/garden.scm b/garden.scm index ac8f4eb..bf6cc48 100644 --- a/garden.scm +++ b/garden.scm @@ -1,12 +1,3 @@ -(import (chicken random) - (chicken time) - (chicken time posix) - (chicken pathname) - (chicken io) - (chicken string) - (chicken format) - srfi-1) - (define rand-double pseudo-random-real) (define (rand-weighted weights) @@ -84,7 +75,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 "[" @@ -126,12 +117,12 @@ ;;; Data (define stage-transition-times - '(10 20 30 40 50)) - ;; (list (* 3600 24) - ;; (* 3600 24 3) - ;; (* 3600 24 10) - ;; (* 3600 24 20) - ;; (* 3600 24 30))) + ;; '(10 20 30 40 50)) ; for debugging + (list (* 3600 24) + (* 3600 24 3) + (* 3600 24 10) + (* 3600 24 20) + (* 3600 24 30))) (define stages '(seed seedling young mature flowering seed-bearing))