[Question]
  [
So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code...
Here's a (short) example output:
```
                +
                 +
                  +
                   +
                   +
                   +
                  +
                   +
                    +
                    +
                    +
                     +
                     +
                      +
                      +
                       +
                      +
                     +
                     +
                    +
```
Here's the specs:
* In each line, a single non-whitespace character (whichever you like) is printed to the console, initially with 29 to 31 spaces padding to the left of it.
* Each iteration, a random decision is made between these three actions
	+ The amount of padding decreases by 1
	+ The amount of padding remains the same
	+ The amount of padding increases by 1
Do this 30 times, to print 30-segment long a snake to the console.
The shortest answer in bytes wins.
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~15~~ 14 bytes
```
30DF2Ý<+ΩD0sú,
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f2MDFzejwXBvtcytdDIoP79L5/x8A "05AB1E – 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
```
[Answer]
# [Random Brainfuck](https://github.com/TryItOnline/brainfuck), ~~123 122~~ 121 bytes
```
+[--[<]>>+<-]>+[->+>+>+<<<]++++++++++>>++<[>>[->+<<.>]>[-<+>]>?>+++<[>->+<[>]>[<+>-]<<[<]>-]>-->,<[-<<<+>>>]<<<<+.-<<.>-]
```
[Try it online!](https://tio.run/##PYxBCsMwDAQfpK5fsGwfYnRIGwIl1AVD3u@sLpUOkmbEzm3svy9ec/uM43qfa0UHOlMKIuVLUU0y41@2wS6VJZvSG8PjaVGmeC9siiQr0XGAHvQrjSVzLw2VgFzrBg "Random Brainfuck – 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!](https://tio.run/##PYlRCoAwDEMPVLMTlHiQ0o@pCCJOGHj@2n1oEkja12vb7gtLr0fbn/WMEANMnRSFMy/KsKq6/GLGOFj@C@m5VeizTV@BnkwKBodHvA "Random Brainfuck – 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.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~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!](https://tio.run/##HclBCoAgEEDRfacQQZiphMJNIN6kjWjGLLJQd9LZTVp9@M/J07nWSAfIWMOdIBsyatVSkn4SxRKAi9Hvkc95MqtMNnpAoeYNUb/tshQBWR0Yyz8Vug5YuvUToOdtHw "C (gcc) – Try It Online")
[Answer]
## [Retina](https://github.com/m-ender/retina/wiki/The-Language), 24 bytes
```
30* +
-29{¶<`^
 
S,2@1`
```
[Try it online!](https://tio.run/##K0otycxLNPz/n8vYQEtBm0vXyLL60DabhDguBa5gHSMHw4T//wE "Retina – Try It Online")
### Explanation
```
30* +
```
Initialise the working string to the first line, i.e. 30 spaces and a `+`.
```
-29{¶<`^
 
```
There's a space on the second line. `-29{` wraps the remainder of the program in a loop, which is run 29 times. `¶<` prints the working string at the beginning of each loop iteration with a trailing linefeed. The atomic stage itself inserts a space at the beginning of the string (the basic idea is to insert one space, and then randomly remove 0–2 spaces, because that's a byte shorter than randomly choosing between deletion, inserting and no-op).
```
S,2@1`
```
This matches the empty regex against the input, which gives us every position between characters (and the start and end of the string). Then `,2` keeps only the first three matches, i.e. the matches after zero, one and two spaces. `@` selects a random one of those three matches. Then the split stage (`S`) splits the input around that match. And the `1` tells it to keep only the second part of the split. In other words, we discard everything up to our random match.
The 30th line, which is the result of the final loop iteration, is printed implicitly at the end of the program.
[Answer]
# JavaScript (ES8), ~~63~~ ~~62~~ 60 bytes
Includes a trailing newline. `*2-1` could be replaced with `-.5` for a 1 byte saving but the chances of each line being the same length as the previous line would be greatly increased. Of course, as "random" isn't defined in the challenge, the RNG *could* be replaced with `new Date%3-1` for a total byte count of [55](https://tio.run/##BcFBCoAgEADAe6/oEuwiStEt2LrUP1bSohCNlLLX28ypHx3X@7iS9MHYsgYfg7PKhR2gbASZPupbpDFPzOrSZvEGPkHevvWsk2162aFgUbHYQMqMA3NBQCw/).
```
f=(x=y=30)=>x?``.padEnd(y+=Math.random()*2-1)+`+
`+f(--x):``
```
Saved a byte thanks to someone who deleted their comment before I could catch the name. I'd actually tried it this way with `repeat` and `padStart` but didn't think to try `padEnd` - don't know why!
```
o.innerText=(
f=(x=y=30)=>x?``.padEnd(y+=Math.random()*2-1)+`+
`+f(--x):``
)()
```
```
<pre id=o>
```
---
## Bonus
For the same number of bytes, here's a version that takes the number of starting spaces & iterations as input.
```
f=(x,y=x)=>x?``.padEnd(y)+`+
`+f(--x,y+Math.random()*2-1):``
```
```
o.innerText=(
f=(x,y=x)=>x?``.padEnd(y)+`+
`+f(--x,y+Math.random()*2-1):``
)(i.value=30);oninput=_=>o.innerText=f(+i.value)
```
```
<input id=i type=number><pre id=o>
```
[Answer]
# VBA, ~~60~~ ~~59~~ 49 Bytes
```
For l=1To 30:?Spc(30+i)"+":i=i+Sgn(Rnd()-.5):Next
```
Paste it in the Immediate window and hit enter. (Make sure explicit declaration is turned off!)
*Far* more likely to move than to stay in a line (i.e. actions are not equally weighted) but that was not a specified requirement (Fortunately!)
**{EDIT}** *Saved 1 byte by removing the space between `=1` and `To`*
**{EDIT2}** *Saved **10** bytes thanks to remoel's comment*
Old Versions:
```
'V1
i=30:For l=1 To 30:?String(i," ")&"+":i=i+Sgn(Rnd()-.5):Next
'V2
i=30:For l=1To 30:?String(i," ")&"+":i=i+Sgn(Rnd()-.5):Next
```
[Answer]
# C# (.NET Core), ~~112~~ ~~110~~ ~~106~~ ~~100~~ ~~99~~ 98 bytes
```
v=>{var r="";for(int t=30,i=t;i-->0;r+="+\n".PadLeft(t+=new System.Random().Next(3)-1));return r;}
```
-1 byte thanks to *@raznagul*.  
-1 byte thanks to *@auhmaan*.
**Explanation:**
[Try it online.](https://tio.run/##TY6xqsJAEEV7v2JItUtMUCzXTSNYPR@ihY3NupnISpyF2UlUJN8eY/HgtZdzD8enwkfG0bcuJdi9ZwBJnAQPfQw17Fwgpb8rwPGVBO/ltiO/jpcbeplPLAe6VtCAhbG31bt3DGyzzDSRVSABsavFPFgxoSiqheHcZvmZsnLv6h9sREluCR9/8oOjOt6VLn/xKWqli6XWhlE6JmAzjN8O879mEynFFssTB0HVKOradrpMyDAbxg8)
```
v=>{                      // Method with empty unused parameter and no return-type
  var r="";               //  Result-string, starting empty
  for(int t=30,           //  Temp-integer, starting at 30
      i=t;i-->0;          //  Loop 30 times
    r+=                   //   Append the result-String with:
       "+\n"              //    The character and a new-line,
            .PadLeft(     //    left-padded with `t` spaces,
                     t+=new System.Random().Next(3)-1));
                          //    after `t` first has been changed with -1, 0, or 1 randomly
  return r;}              //  Return the result-string
```
[Answer]
# C, 56 bytes
```
n;f(p){n>29?n=0:f(printf("%*d\n",n++?p-rand()%3:31,0));}
```
[Try it online!](https://tio.run/##S9ZNT07@/z/POk2jQLM6z87I0j7P1sAKyCvKzCtJ01BS1UqJyVPSydPWti/QLUrMS9HQVDW2MjbUMdDUtK79D1SkkJuYmaehyVXNpQAExWA1JZm5qRogFWCxNA0go/Y/AA)
**Explanation:**
```
n; // As a global variable, n is initialized to zero.
f(p)
{
    // Call the function recursively until n > 29.
    n > 29
        // At the end, set n back to zero.
        ? n=0
        // On the first iteration, n == 0 and p has an indeterminate value.
        // 'n++ ? p-rand()%3 : 31' returns 31 (without reading p), and thus
        // 30 spaces get printed. printf() returns the number of characters
        // printed, 32 (30 spaces + '0' + '\n').
        //    On subsequent iterations, p has the value the previous printf
        // call returned, which is the padding on last iteration + 2. Also,
        // n > 0, so the same expression now returns p-rand()%3, and thus
        // the padding changes either by -1, 0, or 1 spaces. The function
        // is again called with the value of the current line's padding + 2.
        : f(printf("%*d\n", n++ ? p-rand()%3 : 31, 0));
}
```
# [C (gcc)](https://gcc.gnu.org), 55 bytes
```
n;f(p){n=n<30&&f(printf("%*d\n",n++?p-rand()%3:31,0));}
```
Depends on **f** "returning" the value assigned to **n** in the function, which is undefined behaviour, but works consistently with gcc when no optimizations are enabled.
[Try it online!](https://tio.run/##S9ZNT07@/z/POk2jQLM6zzbPxthATQ3IKcrMK0nTUFLVSonJU9LJ09a2L9AtSsxL0dBUNbYyNtQx0NS0rv0PVKSQm5iZp6HJVc2lAATFYDUlmbmpGiAVYLE0DSCj9j8A)
[Answer]
# Java 8, ~~89~~ 87 bytes
First golf, I'm sure it could be much better..
Edit: Fixed first line thanks to [Steadybox](https://codegolf.stackexchange.com/users/61405/steadybox).
```
l->{for(int a=31,b=a;--a>0;){System.out.printf("%"+b+"c\n",'+');b+=2-Math.random()*3;}}
```
[Try it online!](https://tio.run/##NY5PD4IwDMXvfoqGxLiJIyrHBY/cOJl4UQ9lMEXHRmCYGMJnx/qvafPSpnnvd8MHCteU9lbcJ2Ww6yDDyg4zgMr6stWoSkjfK9XDVQUodniL4ZKOIw1159FXClLQkMBkxG7QrmVkAJjEm1WeoBQCd2vJh/2z82Udud5HTUsfmgXzIMzDQJ1ssFqECy7zMNmKDP01atEWrmZ8GctxnOQ3rOlzQ2G/zA9TTchs78nvcjwj/@LqSDHbmz/oOL0A "Java (OpenJDK 8) – Try It Online")
```
 l->{                                           //Begin lambda
    for(int a=31,b=a;--a>0;)                  //Initialise vars, loop through 30 lines
    {
        System.out.printf("%"+b+"c\n",'+');     //Print result
        b+=2-Math.random()*3;                   //Change padding by -1, 0, or 1
    }
```
[Answer]
# [Python 2](https://docs.python.org/2/) , ~~83~~ ~~65~~ 64 bytes
Straightforward approach:
```
import os
k=30
exec"print' '*k+'+';k+=ord(os.urandom(1))%3-1;"*k
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P60oP1ehKDEvBUhl5hbkF5VocWXbGhtwpVakJisVFGXmlagrqGtla6trq1tna9uClALFNHQNdQw1rZW0sv//BwA "Python 2 – Try It Online")
Thanks to @Rod for saving some bytes!
Thanks to @ovs for -1 byte!
Edit: changed variable name and output string to the letter 's'
# More snake-like output for 88 bytes:
```
from random import*
s=[30,0]
exec"print' '*sum(s)+'(S)'[s[-1]+1];s+=[randint(-1,1)];"*30
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 20 bytes
*1 byte saved thanks to [ngn](https://codegolf.stackexchange.com/users/24908/ngn)*
```
↑'+'↑⍨¨-+\30,2-?29⍴3
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT////1Hf1EdtEx61TVTXVgeSj3pXHFqhqx1jbKBjpGtvZPmod4vx//8A "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~14~~ 11 bytes
```
× ³⁰Ｆⅈ✳～‽³+
```
[Try it online!](https://tio.run/##JcoxCoAwDADA3VeETgkqCI5u4iwiDq6lVgy0DdSiz4@DN5@7bHZig@qSORXcOPobDZgG@o5oqE7JgDsSwR8mzt4VloQjl5dvP0vB1aZDIvZE1ICpDQ2q2j7hAw "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
× ³⁰        Print 30 spaces (forces the desired indentation)
    Ｆⅈ      Repeat the same number of times
      ✳～‽³  Move a random downward direction after printing
          + Print a `+`
```
Would be only ~~10~~ 8 bytes if there was no initial indentation requirement.
[Answer]
# PHP, 61 bytes
```
for($p=32;$i<30;$i++)echo str_pad("+
",$p+=rand(-1,1),' ',0);
```
[Try it online!](https://tio.run/##K8go@P/fxr4go4CLKy2/SEOlwNbYyFol08bYAEhqa2umJmfkKxSXFMUXJKZoKGlzKemoFGjbFiXmpWjoGuoYauqoK6jrGGha//8PAA "PHP – Try It Online")
[Answer]
# Perl, 36 bytes
```
perl -E '$#a=29;map{$#a+=rand(3)-say"@a -"}@a'
```
[Answer]
# Java 8, ~~131~~ ~~129~~ ~~127~~ ~~126~~ ~~119~~ ~~108~~ 101 bytes
```
v->{String r="";for(int i=30,j,t=i;i-->0;r+="+\n")for(j=t+=Math.random()*3-1;j-->0;r+=" ");return r;}
```
**Explanation:**
[Try it online.](https://tio.run/##PY/BasMwDIbvewrhk73UoaNH475Bexns0u2gOe5mN5GDowRKybNnDg0D6SDpR//3R5xQp95TbG6La3EY4ISBHi8AgdjnKzoP53UEeOcc6Aec/EihgUmZsp1LlxoYOTg4A4GFZdLHxybOVghzTVmWbxDsYb@LO7bBBK2Pe5MrK6pPEmpVRMuVPSH/1hmpSZ1Urwf9ZuK/EoQy2fOYCbKZF/O07sfvtlhvBNOK1pUE8glw@UK10d8H9l2dRq77cmFJtZM0tq3agszLHw)
```
v->{                     // Method with empty unused parameter and String return-type
  String r="";           //  Result-String, starting empty
  for(int i=30,j,t=i;    //  Two index integers, and a temp integer (starting at 30)
      i-->0;             //  Loop 30 times:
      r+="+\n")          //    After every iteration: Append the character and a new-line
    for(j=t+=Math.random()*3-1;
                         //   Change `t` with -1, 0, or 1 randomly
        j-->0;r+=" ");   //    And append that many spaces to the result-String
  return r;}             //  Return the result-String
```
**Old 119 byte answer:**
```
v->{String s="",r=s;int i=90,t=30;for(;i-->t;s+=" ");for(;i-->0;t+=Math.random()*3-1)r+=s.substring(t)+"+\n";return r;}
```
**Explanation:**
[Try it online.](https://tio.run/##RY/BasMwEETv/YpFJ6mOhEtORSh/kFwCubQ9KLLSKrUlo10ZSvC3u0pjKOwedmYZ3lztZGUafbx234vrLSLsbYi3J4AQyeeLdR4O9xPgSDnET3D8lEIHk9BVnevWQbIUHBwggoFlkrvb@oyGsU02qGsaBPPabshsW31Jmesg5Y40NoYBE/9Sq6kxe0tfKtvYpYGL5618EbkxqLCc8S@Yk2hY8x6Zzp5KjpD1vOgHzFjOfYVZmaY77FA78QfS24cVa58fJD@oVEiN1SEeleOx9L1Yq83LLw)
```
v->{                      // Method with empty unused parameter and String return-type
  String s="",            //  Temp-String, starting empty
         r=s;             //  Result-String, starting empty
  int i=90,t=30;          //  Temp integer, starting at 30
  for(;i-->t;s+=" ");     //  Fill the temp String with 60 spaces
  for(;i-->0;             //  Loop 30 times:
      t+=Math.random()*3-1//    After every iteration: Change `t` with -1, 0, or 1 randomly
    r+=s.substring(t)     //   Append the result with `60-t` amount of spaces
       +"+\n";            //   + the character and a new-line
  return r;}              //  Return the result-String
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 12 bytes
```
30:(kɽ℅+:×꘍,
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=&code=30%3A%28k%C9%BD%E2%84%85%2B%3A%C3%97%EA%98%8D%2C&inputs=&header=&footer=)
```
30:          # Push 30 twice
   (         # Iterate over one copy (30 times)
       +     # Increment the number on the stack (initially 30) by...
      ℅      # A random choice from
    kɽ       # [-1, 0, 1]
        :    # Duplicate
         ×꘍  # Prepend that many spaces to an asterisk
           , # And output, leaving the number on the stack
```
[An alternative](https://lyxal.pythonanywhere.com?flags=j&code=30%3A%C6%9B3%CA%81%E2%80%B9%E2%84%85%3B%C2%A6%2B%C3%97%EA%98%8D&inputs=&header=&footer=)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~13~~ 12 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Outputs an array of lines.
The first line can be removed, saving 3 bytes, to allow the number of starting spaces & iterations to be taken as input.
```
30
°ÆQùU±Ó3ö
```
[Test it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=MzAKsMZR%2bVWx0zP2&input=LVI) or [try it with input](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=sMZR%2bVWx0zP2&input=MzAKLVI)
```
30\n°ÆQùU±Ó3ö
30\n              :Assign 30 to variable U
    °             :Postfix increment U
     Æ            :Map the range [0,30)
      Q           :  Quotation mark
       ù          :  Left pad with space to length
        U±        :    Increment U by
          Ó       :      Bitwise NOT of the negation of (i.e., decrement)
           3ö     :      Random integer in the range [0,3)
```
[Answer]
# [R](https://www.r-project.org/), ~~72~~ ~~69~~ 67 bytes
```
cat(sprintf(paste0("% ",cumsum(c(30,sample(3,29,T)-2)),"s"),"+\n"))
```
Thanks to [Zahiro Mor](https://codegolf.stackexchange.com/users/65449) for 2 extra bytes!
[Try it online!](https://tio.run/##K/r/PzmxRKO4oCgzryRNoyCxuCTVQENJVUFJJ7k0t7g0VyNZw9hApzgxtyAnVcNYx8hSJ0RT10hTU0epWAlIaMfkKWlq/v8PAA "R – Try It Online")
[Answer]
# [Swift](https://developer.apple.com/swift/), 101 bytes
```
import UIKit
var g=29;for _ in 0...g{print((0..<g).map{_ in" "}.joined(),0);g+=Int(arc4random()%3)-1}
```
## Explanation
A full program. This uses a rather odd trick: `arc4random()` is a member of the `Darwin` module, but `UIKit` also comes with this function installed, so it saves a byte :) Also uses one of my [Swift golfing tips](https://codegolf.stackexchange.com/a/137931/59487) for repeating strings an arbitrary number of times.
```
import UIKit        // Imports the UIKit module, necessary for the RNG.
var g=29;           // Declares an integer variable g by assigning it to 30.
for _ in 0 ... g {  // Execute the code block 30 times (for each integer in [0; g]):
 print(             // Output the following:
  (0..<g).map       // For each integer in [0; g)...
   {_ in" "}        // ... return a literal space character. 
    .joined()       // ... And join the result to a single string.
             ,0     // Also print a "0" preceded by a single space (g starts from 29).
 );
g+=                 // Increment the variable g by...
   arc4random()%3   // ... A random integer, modulo 3...
   Int(...)-1       // ... Casted to an integer (yes, this is needed!) and decremented.
}
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 18 bytes
```
1ŒRX+
30Ç’Ð¡⁶ẋ;€0Y
```
[Try it online!](https://tio.run/##AScA2P9qZWxsef//McWSUlgrCjMww4figJnDkMKh4oG24bqLO@KCrDBZ//8 "Jelly – Try It Online")
The chosen character is **0**. If returning a list of list of characters is allowed, then the `Y` can be dropped and the submission can be turned into a niladic chain for **[17 bytes](https://tio.run/##AS0A0v9qZWxsef//McWSUlgrCjMww4figJnDkMKh4oG24bqLO@KCrDD/wqLFkuG5mP8)**. [Alternative](https://tio.run/##ASgA1/9qZWxsef//M1hD4oCYKwozMMOH4oCZw5DCoeKBtuG6izvigqwwWf//).
## How it works
```
30Ç’Ð¡⁶ẋ;€0Y | Niladic main link.
30           | Starting from 30...
  Ç’Ð¡       | ... Repeat the helper link 29 times and collect the results in a list.
             | (This list includes the first 30, so there are actually 30 numbers).
      ⁶ẋ     | Repeat a space that many times, for each item in the list.
        ;€0  | Append a 0 to each.
           Y | And join by newlines.
-------------+
1ŒRX+        | Monadic helper link. Alternatively, you can use µ1ŒRX+µ instead of the Ç.
1            | The literal one.
 ŒR          | Symmetric range from –1 to 1.
   X+        | Choose a random number therein and add it to the argument.
```
# [Jelly](https://github.com/DennisMitchell/jelly), 16 bytes
Combining mine, Erik’s and Jonathan’s solutions, we can golf this down to 16 bytes. The chosen character is **1**.
```
’r‘X
30Ç’Ð¡Ṭ€o⁶Y
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw8yiRw0zIriMDQ63AzmHJxxa@HDnmkdNa/IfNW6L/P8fAA "Jelly – Try It Online")
Thanks to Jonathan Allan for the heads-up (on `Ṭ€o⁶`).
[Answer]
# R, ~~54~~ 53 bytes
```
cat(sprintf('
%*s',cumsum(c(30,sample(3,29,T)-2)),0))
```
Similar idea [as above](https://codegolf.stackexchange.com/a/156250/1710), but with shortened `sprintf` code and a shorter character string literal. Instead of `\n` (two bytes) I’m using a literal line break (one byte).
`[Try it online!](https://tio.run/##K/r/PzmxRKO4oCgzryRNQ51LVatYXSe5NLe4NFcjWcPYQKc4MbcgJ1XDWMfIUidEU9dIU1PHQFPz/38A)`
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~45~~ 39 bytes
```
x=30
x.times{puts' '*(x+=rand(3)-1)+?S}
```
[Try it online!](https://tio.run/##KypNqvz/v8LW2ICrQq8kMze1uLqgtKRYXUFdS6NC27YoMS9Fw1hT11BT2z649v9/AA "Ruby – Try It Online")
Modifying `x` during the loop does not affect the loop counter. I chose S as a particularly snakelike output character.
-6 bytes: Use `rand(3)-1` instead of `[-1,0,1].sample`. *Thanks, [Eric Duminil](https://codegolf.stackexchange.com/users/65905/eric-duminil)!*
[Answer]
# [SenseTalk](http://sensetalk.com), 237 198 Bytes
This is a language that I came to know and love about a decade ago. It's the scripting language that drives the automated testing tool [Eggplant Functional](https://www.testplant.com). I was an avid user of the tool for many years before joining the company for a while. It's not the most golf-capable language, but I find it very enjoyable to write in. Golfing in it is actually quite challenging as the language is meant to be verbose and English-like... took me quite a while to get it down to 237 bytes.
```
set s to "                              +"&lf
set p to s
repeat 30
set a to random(0,2)
if a equals 0
delete first char of p
else if a equals 1
put " " before p
end if
put p after s
end repeat
put s
```
## Ungolfed/Explanation
```
set the_snake to "                              +"&lf #assign the first line of the snake
set previous_line to the_snake                        #set up for the loop
repeat 30 times                                       #loop 30x
    set action to random(0,2)                         #random add/subtract/stay the same
    if action equals 0
        delete the first character of previous_line   #SenseTalk really shines at string manipulation
    else if action equals 1
        put " " before previous_line                  #insert a character at the beginning
    end if
    put previous_line after the_snake                 #plop the new segment into the string
end repeat                                            #close the loop
put the_snake                                         #print to standard out
```
Edit: Saved 36 bytes thanks to @mustachemoses
[Answer]
# [J](http://jsoftware.com/), 23 bytes
```
echo(8":~+/)\31,1-?29$3
```
[Try it online!](https://tio.run/##y/r/PzU5I1/DQsmqTltfM8bYUMdQ197IUsX4/38A "J – Try It Online")
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 42 bytes
```
1..($l=30)|%{" "*$l+"x";$l+=-1,0,1|Random}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/31BPT0Mlx9bYQLNGtVpJQUlLJUdbqULJGkjZ6hrqGOgY1gQl5qXk59b@/w8A "PowerShell – Try It Online")
Loops from `1` to `$l=30`. Each iteration we put `$l` spaces plus an `x` onto the pipeline as a string, then `+=` either of `-1, 0, 1` based on `Get-Random` into `$l` for the next loop. Those strings are gathered from the pipeline and an implicit `Write-Output` gives us a newline-separated list for free.
[Answer]
# Bash, 53
* 3 bytes saved thanks to @Dennis
```
for((i=p=30;i--;p+=RANDOM%3-1));{ printf %${p}s+\\n;}
```
[Try it online](https://tio.run/##S0oszvj/Py2/SEMj07bA1tjAOlNX17pA2zbI0c/F31fVWNdQU9O6WqGgKDOvJE1BVaW6oLZYOyYmz7r2/38A).
[Answer]
# [Octave](https://www.gnu.org/software/octave/), ~~53 51 50~~ 49 bytes
```
printf('%*d\n',[a=31+cumsum(randi(3,1,30)-2);~a])
```
[Try it online!](https://tio.run/##y08uSSxL/f@/oCgzryRNQ11VKyUmT10nOtHW2FA7uTS3uDRXoygxLyVTw1jHUMfYQFPXSNO6LjFW8/9/AA "Octave – Try It Online")
Saved 1 byte by no longer doing any looping. Saved another as Octave has `printf` as well as `fprintf`.
This new code creates an array of 30 random integers in the range `-1:1`. It then cumulatively sums the array and adds 30, which gives the desired sequence.
The result is printed using `fprintf` with a format that says "A decimal number, padded to a specified width, followed by a new line. The width will be the first value input, and the decimal number will be the second value input. If the number of values input is more than this, Octave will keep repeating the print automatically to get the desired output.
To achieve the looping then, we need only interleave zeros between the sequence array so the `fprintf` function uses each value in the sequence as a width, and each zero as the digit to be printed.
Prints an output like:
```
                              0
                             0
                              0
                             0
                              0
                               0
                              0
                               0
                              0
                              0
                             0
                            0
                           0
                           0
                           0
                          0
                           0
                            0
                             0
                              0
                              0
                             0
                             0
                              0
                               0
                              0
                              0
                               0
                               0
                                0
```
---
The above code doesn't always print exactly 30 spaces on the first line. It will be either 29, 30, or 31. To correct that, you would use this 53 byte version:
```
x=31;for i=2:x;fprintf('%*d\n',x,0);x+=randi(3)-2;end
```
[Answer]
## Lua, ~~81~~ 75 bytes
```
n=30;for i=1,n do print(("%-"..n.."s+"):format(" "))n=n-2+math.random(3)end
```
In `for i=1,n ...` the *to\_exp* `n` is evaluated only once before entering the loop, saving one byte.
-6 thanks to @user202729
[Try it online!](https://tio.run/##DcpRCoAgDADQq4xBMDFH5V/hYQSLhJxhdf7l54N3fVFVgp@2ozbIYR4FUoW7ZXmJcHDILMz4WDRrLyW@hIDGSBC32M6TW5RUC3mzS1L9AQ)
[Answer]
# [Python 3.6](https://python.org), ~~84~~ ~~73~~ 69 bytes
```
from random import*
x=30
exec("print(' '*x+'+');x+=randint(-1,1);"*x)
```
Thanks to @WheatWizard for -11 bytes.
Thanks to @JoKing for -4 bytes.
[Answer]
# ES5, ~~97~~ ~~95~~ 81 bytes
```
for(p=i=30;i--;)console.log(Array(p).join(" ",r=Math.random()*3|0,p+=r>1?-1:r)+0)
```
**ES5, ~~112~~ 98 bytes** if function format is needed: 
```
function a(){for(p=i=30;i--;)console.log(Array(p).join(" ",r=Math.random()*3|0,p+=r>1?-1:r)+0)}a()
```
]