Snake Shit

From Esolang
Jump to navigation Jump to search

Language Overview

Snake Shit is an esoteric programming language where a snake is simulated moving around a grid. Each step, the snake moves in the direction that it is set to. If it's head is on any of the commands below, it will execute that command. Any other characters are ignored, though using _s for places that the snake would go is good practice. The snake can not crash into itself, but if the snake ever moves onto a space without a character, it will quit the program.

Instructions

Some commands take arguments. Arguments are found to the right of the current command.

Command Arguments Description
$ Direction : ^, <, v, or > Start : The snake starts here, and starts moving in the direction specified.
+ Number : Any number 0 or greater. Increase Length : Increase the snake's tail length by the number given.
- Number : Any number 0 or greater. Decrease Length : Decrease the snake's tail length by the number given (The tail length can not go below 0).
= Number : Any number 0 or greater. Set Length : Set the snake's tail length to the number given.
^ Set Direction Up : Change the snake's moving direction to up.
> Set Direction Right : Change the snake's moving direction to right.
v Set Direction Down : Change the snake's moving direction to down.
< Set Direction Left : Change the snake's moving direction to left.
@ Character : Escape codes are allowed for \n, \t, and \\. Save Length : Write the snake's length to a variable with the name specified.
% Character : Escape codes are allowed for \n, \t, and \\. Load Length : Set the snake's length to the value stored in a variable with the name specified.
~ Command : Another command. If : If the snake's length is not 0, run the command specified.
& Number Input : Wait until a number has been entered into the console.
? Number : Any number 0 or greater. Random Length : Set the snake length to a random number between 0 (inclusive), and the number specified (exclusive).
# Print : Print the specified character to the console (without trailing newline).
* Print Length : Print the length of the snake tail to the console (without trailing newline).

Examples

Hello World

A simple program that prints Hello World!\n

$>#H#e#l#l#o# #W#o#r#l#d#!#\n

The snake starts at the $ and moves right because of the >. It then travels over the #s and prints the characters the right of them.

Test x10

This program prints test\n 10 times, then prints \nlol\n.

#\n
#!
#l
#o
#l  $v
#\n =10
~>-1v
#\n #t
#t  #e
^#s_<

The snake start at the $ at moves downwards. It then sets its length to 10. It moves downwards and around the loop printing test\n before getting to the ?. Since the snake length is greater than 0, it will turn right, reduce it's length by one, and repeat it over again. Once the tail length is 0, it will not turn right, and instead print \nlol\n before quitting.

Number Guessing Game

This program will give you 7 tries to guess a number from 5 to 95, and will tell you whether your answer is too big or too small for each wrong answer.

>___%A_#Y#o#u# #L#o#s#e#!#\n#T#h#e# #C#o#r#r#e#c#t# #A#n#s#w#e#r# #W#a#s# *#.#\n
_
_ $>_#\n#W#e#l#c#o#m#e# #T#o# #T#h#e# #N#u#m#b#e#r# #G#u#e#s#s#i#n#g# #G#a#m#e#.#\n#\n_v
_  v___________________________________________________________________________________<
_  =7
_  @T                                        _ >_%A-1@D_v
_  ?90                                       _ _   >__%D~v
_  +5                                        _ _   @I   _>_v
_  @A                                        _ _   -1   -1 %I
~>_>__%T_*# #T#r#i#e#s# #L#e#f#t#.#\n________v _   ^%I@D<  >~v
@T v_________________________________________< _            _>__#T#o#o# #S#m#a#l#l#.#\n_v
-1 >_____#E#n#t#e#r# #A# #N#u#m#b#e#r#:# &@I___^            -1                          _
%T                                                          ~>__#T#o#o# #B#i#g#.#\n_____v
_  v____________________________________________________________________________________<
_  _                                                        _
_  _                                                        >#Y#o#u# #W#i#n#!#\n
_  >_____#I#n#c#o#r#r#e#c#t#!#\n#\n__________v
_                                            _
^____________________________________________<

Sample output:

Welcome To The Number Guessing Game.

7 Tries Left.
Enter A Number: 50
Too Small.
Incorrect!

6 Tries Left.
Enter A Number: 75
Too Big.
Incorrect!

5 Tries Left.
Enter A Number: 62
Too Small.
Incorrect!

4 Tries Left.
Enter A Number: 69
Too Big.
Incorrect!

3 Tries Left.
Enter A Number: 65
Too Small.
Incorrect!

2 Tries Left.
Enter A Number: 67
You Win!