Skip to main content
deleted 2 characters in body
Source Link
Steadybox
  • 16.5k
  • 5
  • 41
  • 84

ES5, 97 95 81 bytes

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()

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()

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()

@Shaggy in the comments suggested improvements, shaving off 14 bytes
Source Link

ES5, 97 9595 81 bytes

p=30;forfor(i=0;i<p;i++p=i=30;i--;){console.log(Array(p).join(" ")+"+\n");r=~~(Math,r=Math.random()*3);p+=r==2*3|0,p+=r>1?-1:r})+0)

ES5, 112112 98 bytes if function format is needed:

function a(){p=30;forfor(i=0;i<p;i++p=i=30;i--;){console.log(Array(p).join(" ")+"+\n");r=~~(Math,r=Math.random()*3);p+=r==2*3|0,p+=r>1?-1:r})+0)}a()

ES5, 97 95 bytes

p=30;for(i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}

ES5, 112 bytes if function format is needed:

function a(){p=30;for(i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}}a()

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()

moved i=0 to for loop
Source Link

ES5, 9797 95 bytes

p=30;i=0;forp=30;for(i;i<p;i++i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}

ES5, 112 bytes if function format is needed:

function a(){p=30;for(i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}}a()

ES5, 97 bytes

p=30;i=0;for(i;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}

ES5, 112 bytes if function format is needed:

function a(){p=30;for(i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}}a()

ES5, 97 95 bytes

p=30;for(i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}

ES5, 112 bytes if function format is needed:

function a(){p=30;for(i=0;i<p;i++){console.log(Array(p).join(" ")+"+\n");r=~~(Math.random()*3);p+=r==2?-1:r}}a()

Added function
Source Link
Loading
Source Link
Loading