Skip to main content
4 of 4
added 6 characters in body
Eliseo D'Annunzio
  • 7.6k
  • 1
  • 37
  • 76

JavaScript ES6 125 - 10 (30 character lines) - 50 (shifts toward middle) = 65

I had an epiphany going up the lift to my unit, so I had to get it down before it left my memory...

z=(j=Array(t=29).join`_`)+"."+j;x=(r=Math.random)()*t;for(i=30;i--;)console.log(z.substr(x=(x+=r()<x/t?-1:1)>t?t:x<0?0:x,30)) 

A little variable positional shuffling and a little creativity for calculating the shift probability indicated by x/t... (Thanks Kostronor for pointing it out!) I now gain the -50 bonus for shift to the middle, and I also made the starting position within the full range of the line, which allowed me to shave two bytes!

....5....0....5....0....5....0 <-- Ruler _.____________________________ __.___________________________ ___.__________________________ __.___________________________ ___.__________________________ __.___________________________ _.____________________________ __.___________________________ ___.__________________________ __.___________________________ ___.__________________________ ____._________________________ _____.________________________ ______._______________________ _______.______________________ ________._____________________ _______.______________________ ______._______________________ _______.______________________ ________._____________________ _______.______________________ ________._____________________ _________.____________________ __________.___________________ _________.____________________ __________.___________________ ___________.__________________ ____________._________________ _____________.________________ ______________._______________ 
Eliseo D'Annunzio
  • 7.6k
  • 1
  • 37
  • 76