From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Snackfish is SNACBIT based, and uses commands in Deadfish.


Command Description
i Increment the current snack, wrapping around at the edges
d Decrement the current snack, wrapping around at the edges
s Square the number associated with the current snack, wrapping around at the edges
o Output the current snack


An implementation of Snackfish in Common Lisp shall be produced:

(declaim (type (simple-array simple-string (11)) +SNACBIT-STATES+))

(defparameter +SNACBIT-STATES+
  (make-array 11
    :element-type 'string
      '("Peanut butter cracker"
        "Cosmic brownie"
        "Tortilla chip"
        "Cheese cracker"
        "Potato chip"
        "Peanut butter cup"

(defun normalize-state-number (state-number)
  (declare (type integer state-number))
  (the (integer 1 11)
    (+ 1 (mod (- state-number 1) 11))))

(defun interpret-Snackfish (&optional (initial-code "" initial-code-supplied-p))
  "Launches the Snackfish interpreter, contingently processing the INITIAL-CODE, if supplied, and repeatedly querying the user for a command sequence until a completely empty line is issued, consequently returning NIL."
  (declare (type string initial-code))
  (declare (type T      initial-code-supplied-p))
    with state-number of-type (integer 1 11) = 1
    for  first-cycle-p of-type boolean = T then NIL
    for  commands of-type string
      = (if (and first-cycle-p initial-code-supplied-p)
            (format T "~&>> ")
            (read-line *standard-input* NIL "")))
    while (plusp (length commands))
      (loop for token of-type character across commands do
        (case token
          (#\i       (setf state-number (normalize-state-number (1+ state-number))))
          (#\d       (setf state-number (normalize-state-number (1- state-number))))
          (#\s       (setf state-number (normalize-state-number (* state-number state-number))))
          (#\o       (print (aref +SNACBIT-STATES+ (1- state-number))))
          (otherwise (terpri))))))

Here is also an interpreter in Python by User:None1:

snacklist=['Peanut butter cracker', 'Cosmic brownie', 'Cheezit', 'Cheeto', 'Dorito', 'Tortilla chip', 'Cheese cracker', 'Potato chip', 'Applesauce', 'Peanut butter cup', 'Pickle']
import sys
for i in code:
    if i=='i':
    if i=='d':
    if i=='s':
    if i=='o':