diff options
| author | mryouse | 2022-06-05 03:38:36 +0000 |
|---|---|---|
| committer | mryouse | 2022-06-05 03:38:36 +0000 |
| commit | 30a430b6385c9a98d3e40714c2cc6f6561ec4fa1 (patch) | |
| tree | 35245cf137e78b3b4b9a39f534cce3ffb9ec643d /neighborcat | |
| parent | 1331f8eb139ba9ce158435f1c420aa5873ff358d (diff) | |
finish neighborcat implementation
Diffstat (limited to 'neighborcat')
| -rw-r--r-- | neighborcat/neighborcat.neb | 39 |
1 files 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 <food>") + (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") |
