Maze generation: Difference between revisions
→{{header|EasyLang}}
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 2,516:
[https://easylang.online/apps/_r_maze0.html Run it]
<syntaxhighlight lang="text">
size = 20
n = 2 * size + 1
endpos = n * n -
startpos = n +
#
f = 100 / (n - 0.5)
Line 2,527 ⟶ 2,528:
func show_maze . .
clear
for i
if m[i] = 0
x = (i - 1) mod n
y = (i - 1) div n
color 777
move x * f - f / 2 y * f - f / 2
Line 2,545 ⟶ 2,546:
m[pos] = 0
call show_maze
d[] = [
for i =
d = random
dir = d[d]
d[d] = d[i]
r = (pos - 1) div n
c = (pos - 1) mod n
posn = pos + 2 * offs[dir]
if c <> brdc[dir] and r <> brdr[dir] and m[posn] <> 0
Line 2,561 ⟶ 2,562:
.
func make_maze . .
for i
m[i] = 1
.
Line 2,568 ⟶ 2,569:
.
call make_maze
call show_maze
</syntaxhighlight>
=={{header|EGL}}==
|