From 30a430b6385c9a98d3e40714c2cc6f6561ec4fa1 Mon Sep 17 00:00:00 2001 From: mryouse Date: Sun, 5 Jun 2022 03:38:36 +0000 Subject: finish neighborcat implementation --- neighborcat/neighborcat.neb | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/neighborcat/neighborcat.neb b/neighborcat/neighborcat.neb index c5fa1a8..f475cf2 100644 --- a/neighborcat/neighborcat.neb +++ b/neighborcat/neighborcat.neb @@ -63,40 +63,55 @@ (print (concat "off " PRONOUN " goes!")) (def current-location (locate-cat)) (if (not (empty? current-location)) - (print (concat "need to unlink: " (first current-location)))) + (unlink (first current-location))) ; if there's no eats, exit (def target-eats (get-random-eats)) (if (and (list? target-eats) (empty? target-eat)) (exit)) ; eat the food - ;(unlink target-eats) + (unlink target-eats) ; go to the porch (def target-eats-stem (last (split target-eats "/"))) - ;(def target-porch (user-from-path target-eats)) - (def target-porch "mryouse") + (def target-porch (user-from-path target-eats)) (with-write (concat HOME target-porch PORCH NAME) (write CAT _file_) (write (concat "thank you for the " target-eats-stem "!" (newline)) _file_))) (func init () ; create the new porch and bowl - ;(def new_porch (concat HOME USER PORCH)) - (def new_porch "newporch") + (def new_porch (concat HOME USER PORCH)) (if (not (exists? new_porch)) ($ (concat "mkdir -m 777 " new_porch))) - ;(def new_bowl (concat HOME USER BOWL)) - (def new_bowl "newporch/newbowl") + (def new_bowl (concat HOME USER BOWL)) (if (not (exists? new_bowl)) ($ (concat "mkdir -m 777 " new_bowl))) ; get rid of the old stuff, if applicable ; TODO - - (print "You're all set up!") - - ) + ;(def old_bowl (concat HOME USER "/.bowl")) + ;(if (exists? old_bowl) + ; ($ (concat "mv " old_bowl "/* " new_bowl))) + + (print "You're all set up!")) + +(func feed (food) + (if (not (eq? (list-length food) 1)) + (block + (print "usage: feed ") + (exit 1))) + (if (not (exists? (concat HOME USER BOWL))) + (block + (print "you've got no bowl to put food in! try 'init' first") + (exit))) + (def foodfile (concat HOME USER BOWL "/" (first food))) + (if (exists? foodfile) + (block + (print (concat "you already have " (first food) " in your bowl!")) + (exit))) + (with-write (concat HOME USER BOWL "/" (first food))) + (print (concat "you left some " (first food) " for " NAME "!"))) (func help () (print "neighborcat -- a neighborhood cat") -- cgit v1.2.3