Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Sierpinski-triangle/Pop11/sierpinski-triangle-1.pop11
Normal file
21
Task/Sierpinski-triangle/Pop11/sierpinski-triangle-1.pop11
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
define triangle(n);
|
||||
lvars k = 2**n, j, l, oline, nline;
|
||||
initv(2*k+3) -> oline;
|
||||
initv(2*k+3) -> nline;
|
||||
for l from 1 to 2*k+3 do 0 -> oline(l) ; endfor;
|
||||
1 -> oline(k+2);
|
||||
0 -> nline(1);
|
||||
0 -> nline(2*k+3);
|
||||
for j from 1 to k do
|
||||
for l from 1 to 2*k+3 do
|
||||
printf(if oline(l) = 0 then ' ' else '*' endif);
|
||||
endfor;
|
||||
printf('\n');
|
||||
for l from 2 to 2*k+2 do
|
||||
(oline(l-1) + oline(l+1)) rem 2 -> nline(l);
|
||||
endfor;
|
||||
(oline, nline) -> (nline, oline);
|
||||
endfor;
|
||||
enddefine;
|
||||
|
||||
triangle(4);
|
||||
11
Task/Sierpinski-triangle/Pop11/sierpinski-triangle-2.pop11
Normal file
11
Task/Sierpinski-triangle/Pop11/sierpinski-triangle-2.pop11
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
define triangle2(n);
|
||||
lvars acc = ['*'], spaces = ' ', j;
|
||||
for j from 1 to n do
|
||||
maplist(acc, procedure(x); spaces >< x >< spaces ; endprocedure)
|
||||
<> maplist(acc, procedure(x); x >< ' ' >< x ; endprocedure) -> acc;
|
||||
spaces >< spaces -> spaces;
|
||||
endfor;
|
||||
applist(acc, procedure(x); printf(x, '%p\n'); endprocedure);
|
||||
enddefine;
|
||||
|
||||
triangle2(4);
|
||||
Loading…
Add table
Add a link
Reference in a new issue