Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,31 @@
|
|||
on SierpinskiCarpet(n, char)
|
||||
if (n < 0) then return {}
|
||||
script o
|
||||
property lst1 : {char}
|
||||
property lst2 : missing value
|
||||
end script
|
||||
|
||||
set gap to space
|
||||
repeat with k from 0 to (n - 1)
|
||||
copy o's lst1 to o's lst2
|
||||
repeat with i from 1 to (3 ^ k)
|
||||
set str to o's lst1's item i
|
||||
set o's lst1's item i to str & str & str
|
||||
set o's lst2's item i to str & gap & str
|
||||
end repeat
|
||||
set o's lst1 to o's lst1 & o's lst2 & o's lst1
|
||||
set gap to gap & gap & gap
|
||||
end repeat
|
||||
|
||||
return join(o's lst1, linefeed)
|
||||
end SierpinskiCarpet
|
||||
|
||||
on join(lst, delim)
|
||||
set astid to AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to delim
|
||||
set txt to lst as text
|
||||
set AppleScript's text item delimiters to astid
|
||||
return txt
|
||||
end join
|
||||
|
||||
return SierpinskiCarpet(3, "#")
|
||||
Loading…
Add table
Add a link
Reference in a new issue