Jump to content

Zig-zag matrix: Difference between revisions

m
Line 715:
 
<lang rebol>zigzag: function [n][
voidresult: map 1..n 'x -> map 1..n => 0
 
x: 1, y: 1, v: 0, d: 1
Line 721:
while [v < n^2][
if? all? @[1 =< x x =< n 1 =< y y =< n][
set get voidresult (y-1) (x-1) v
x: x + d, y: y - d, v: v + 1
]
Line 733:
]
]
return result
]
 
1,532

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.