# Turn Your Program into a Snake! [duplicate]

...or "snakes but not too long".

Inspired by this challenge and this comment.

Write a program or a function that takes no input and outputs its own source code formatted as a snake according to the rules below:

1. If your code has any whitespace, it will not be output; it will just be skipped.
2. There will be one character on each column in the output.
3. The first character in the code is placed on the first column of line x.
4. The second character is placed on the second column of either line x, x-1, or x+1. More generally, the nth character (excluding whitespace) goes to the nth column on a line that is one above, one below, or the same as the line on which the previous character went.
5. The character on the highest line will be on the first line in the output; that is, there are no extraneous leading lines. A single, empty trailing line is allowed.

For example, if the code was from python import snake, the output should look like:

      th
y  o       s  ke
f  mp    ni po t na
ro        m  r


or

                    e
k
f                 a
r               n
om    o im    s
p  h n  po t
yt       r


All valid forms of snake should have a nonzero probability of occurring. Your program's source code should contain at least two non-whitespace characters.

This is , so the shortest answer in bytes wins.

## marked as duplicate by Steadybox code-golf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Feb 22 '18 at 19:22

• I assume the initial choice of x should also be random? You might want to clarify that a bit in the initial rules - I don't think you say anything about it until almost the very end. – FryAmTheEggman Feb 22 '18 at 19:04
• @FryAmTheEggman Actually the x depends on the sequence of random numbers on each step. For example, if no character goes on a line above line x, then x is the first line. If characters go at most two lines above x, x will be the third line. – Steadybox Feb 22 '18 at 19:08
• I'm tempted to close this as a dupe of the horizontal ASCII snake challenge. This is the kind of generalised quine which can only be solved by a) obtaining a string representation of your code, and b) slapping the string processing task on top of that. There's really no way avoid the generic payload capable quine or to make the quine part save anything on the basic string processing task, so replacing the input with the source code doesn't really add much to the problem, I'm afraid. – Martin Ender Feb 22 '18 at 19:10
• I'm sorry, but I don't understand what you are saying at all (or where it appears in your question body). Could you try to explain again what row the first character should appear on? Currently I agree with Martin, but if the placement lets you control something of the output then maybe this will be more than just a generalised quine? – FryAmTheEggman Feb 22 '18 at 19:13
• @MartinEnder I could see a program which generates the quine character-by-character (e.g. the standard data--decompresser quine) do both the generation and the special output simultaneously. Outside of that, I think you are correct. – Conor O'Brien Feb 22 '18 at 19:13

4"D34çýSDεXD<X>ŸΩU}W-úζ»"D34çýSDεXD<X>ŸΩU}W-úζ»