Last active
August 29, 2015 13:57
-
-
Save aeharding/9542320 to your computer and use it in GitHub Desktop.
Diagonal star on dinamic grid thingy
This file contains 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
diagDir = false | |
x = 5 | |
y = 9 | |
console.clear() | |
# Initialize that shizzle | |
grid = [] | |
for i in [0...10] | |
grid.push [] | |
for j in [0...10] | |
grid[i].push '-' | |
# Mark that shizzle | |
while grid[x]?[y]? | |
grid[x][y] = '*' | |
if diagDir | |
x++ | |
y++ | |
else | |
x-- | |
y-- | |
# Output that shizzle | |
out = '' | |
for i in [0...grid.length] | |
out += grid[i].join(' ') + '\n' | |
console.log out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment