Last active
October 31, 2018 23:04
-
-
Save gonzamoiguer/3ee789df2ec255ef7e1c0a61fb9da2b4 to your computer and use it in GitHub Desktop.
mini maze for Melt - Polarcontroller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xoff = melt.PenPosition().x, yoff = melt.PenPosition().y; | |
var grid = 3; | |
var alto = 330, ancho = 490; | |
for(let i=0; i<ancho/grid; i++){ | |
for(let j=0; j<alto/grid; j++){ | |
PickOne()? LtR(i*grid, j*grid) : RtL(i*grid, j*grid); | |
} | |
} | |
function PickOne(){ | |
return Math.floor(Math.random()*2) ? true:false; | |
} | |
function RtL(x,y){ | |
melt.line(x+xoff, y+yoff, x+xoff+grid, y+yoff+grid); | |
} | |
function LtR(x,y){ | |
melt.line(x+xoff+grid, y+yoff, x+xoff, y+yoff+grid); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment