Snack
Jump to navigation
Jump to search
Snack is created to eat someone. It was created in 2011 by User:SmallBug
Syntax
| Command | What |
|---|---|
| grave | set eat value to 0 |
| get | get one man more(add one to var) |
| let | let one guy escape(sub one from var) |
| slime | they are afraid of you (display a message and not affect value) |
| eat | eat them (print var and set it to 0) |
| sleep | lay into the grave to sleep (joke output) |
Example
grave get get eat sleep
Prints:
You have eaten as a snack right 2 people. Happy? SLEEP? ARE YOU CRAZY? LETS GET UP FOR MIDNIGHT DINNER
SIMPLE Interpreter
#include <iostream>
using namespace std;
int main (int argc, char * const argv[]) {
string command;
int stack;
while (true) {
cin >> command;
if (command=="grave") {
stack = 0;
} else if (command=="get") {
stack++;
} else if (command=="let") {
stack--;
} else if (command=="slime") {
cout << "Your victims look crazy and awful. They are afraid of you" << endl;
} else if (command=="eat") {
cout << "You have eaten as a snack right " << stack << " people. Happy?" << endl;
stack = 0;
} else if (command=="sleep") {
cout << "SLEEP? ARE YOU CRAZY? LETS GET UP FOR MIDNIGHT DINNER" << endl;
}
}
return 0;
}
Another simple interpreter
' snack interpreter written in QB64 for windows by user Larryrl ' original intgerpretor in c written by the languages creator SmallBug ' it can be found at https://esolangs.org/wiki/Snack ' ' ' dim stack as INTEGER filename$=COMMAND$ if command$="" then filename$="\snack\test.snack" open filename$ for input as #1 x=0 while not eof(1) x=x+1 line input #1,p$(x) wend close #1 tlns=x lnctr=1 while lnctr<tlns+1 if p$(lnctr)="grave" then stack = 0 if p$(lnctr)="get" then stack=stack+1 if p$(lnctr)="let" then stack=stack-1 if p$(lnctr)="slime" then print "Your victims look crazy and awful. They are afraid of you" if p$(lnctr)="eat" then print "You have eaten as a snack right ";stack;" people. Happy?":stack = 0 if p$(lnctr)="sleep" then print "SLEEP? ARE YOU CRAZY? LETS GET UP FOR MIDNIGHT DINNER" lnctr=lnctr+1 wend