Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Sierpinski-carpet/PureBasic/sierpinski-carpet.basic
Normal file
23
Task/Sierpinski-carpet/PureBasic/sierpinski-carpet.basic
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Procedure in_carpet(x,y)
|
||||
While x>0 And y>0
|
||||
If x%3=1 And y%3=1
|
||||
ProcedureReturn #False
|
||||
EndIf
|
||||
y/3: x/3
|
||||
Wend
|
||||
ProcedureReturn #True
|
||||
EndProcedure
|
||||
|
||||
Procedure carpet(n)
|
||||
Define i, j, l=Pow(3,n)-1
|
||||
For i=0 To l
|
||||
For j=0 To l
|
||||
If in_carpet(i,j)
|
||||
Print("#")
|
||||
Else
|
||||
Print(" ")
|
||||
EndIf
|
||||
Next
|
||||
PrintN("")
|
||||
Next
|
||||
EndProcedure
|
||||
Loading…
Add table
Add a link
Reference in a new issue