Code Golf: Your own pet ASCII snake
05AB1E, 15 14 bytes
30DF2Ý<+ΩD0sú,
Try it online!
Uses 0
.
Explanation
30DF2Ý<+ΩD0sú,
30D # Push 30 to the stack (One for the amount of iterations we are going to perform and one for the initial padding)
F # Pop one of the 30s and perform the following that many times...
2Ý # Push [0,1,2] ...
< # and create [-1,0,1] from that
+ # Add the last padding to every entry (e.g. 30 in the beginning resulting in [29,30,31]
Ω # Pick one of the results at random ...
D # and push it to the stack twice
0 # Push 0 (Any character will work fine here) ...
sú # and pad it with the randomly chosen amount of spaces in the front
, # Finally print the result with a trailing newline
Random Brainfuck, 123 122 121 bytes
+[--[<]>>+<-]>+[->+>+>+<<<]++++++++++>>++<[>>[->+<<.>]>[-<+>]>?>+++<[>->+<[>]>[<+>-]<<[<]>-]>-->,<[-<<<+>>>]<<<<+.-<<.>-]
Try it online!
Random Brainfuck is an extension of brainfuck, with the helpful addition of the ?
command, which sets the current cell to a random byte. This prints a snake made of !
s, which looks more like footsteps than a snake funnily enough.
How It Works:
+[--[<]>>+<-]>+ Create the value 30
[->+>+>+<<<] Copy it three times
++++++++++ Create a newline cell
>>++< Adds 2 to the second copy to make it a space and move to the counter
[ While counter
>>[->+<<.>]>[-<+>] Print out the padding cell number of spaces
?>+++<[>->+<[>]>[<+>-]<<[<]>-] Get 3-(random byte%3)
>-->,<[-<<<+>>>] Add (result-2) to the padding cell
<<<<+.-< Print an exclamation mark
<<. Print a newline
>- Decrement counter
] end loop
Another solution that sticks to the letter of the question, rather than the spirit.
87 bytes
+[--[<]>>+<-]>+[->+>+>+<<<]++++++++++>++>[>[->+<<<.>>]>[-<+>]?[,<+>]?[,<->]<<<+.-<.>>-]
Try it online!
This one is heavily biased towards leaving the padding alone, but increasing or decreasing the padding are both equally possible. Each one has a slightly less than 1 in 256 chance to happen.
C (gcc), 61 58 56 bytes
Answer edited to reflect rules changes...
i;f(s){for(s=i=31;--i;printf("%*d\n",s+=1-rand()%3,8));}
Try it online!