39 lines
686 B
Text
39 lines
686 B
Text
nomainwin
|
|
|
|
open "test" for graphics_nsb_fs as #gr
|
|
|
|
#gr "trapclose quit"
|
|
#gr "down; home"
|
|
#gr "posxy cx cy"
|
|
|
|
order =10
|
|
|
|
w =cx *2: h =cy *2
|
|
|
|
dim a( h, h) 'line, col
|
|
|
|
#gr "trapclose quit"
|
|
#gr "down; home"
|
|
|
|
a( 1, 1) =1
|
|
|
|
for i = 2 to 2^order -1
|
|
scan
|
|
a( i, 1) =1
|
|
a( i, i) =1
|
|
for j = 2 to i -1
|
|
'a(i,j)=a(i-1,j-1)+a(i-1,j) 'LB is quite capable for crunching BIG numbers
|
|
a( i, j) =(a( i -1, j -1) +a( i -1, j)) mod 2 'but for this task, last bit is enough (and it much faster)
|
|
next
|
|
for j = 1 to i
|
|
if a( i, j) mod 2 then #gr "set "; cx +j -i /2; " "; i
|
|
next
|
|
next
|
|
#gr "flush"
|
|
|
|
wait
|
|
|
|
sub quit handle$
|
|
close #handle$
|
|
end
|
|
end sub
|