Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
48
Task/Cantor-set/FutureBasic/cantor-set.basic
Normal file
48
Task/Cantor-set/FutureBasic/cantor-set.basic
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
_window = 1
|
||||
|
||||
_width = 81
|
||||
_height = 5
|
||||
|
||||
window _window, @"FutureBasic Cantor Set", ( 0, 0, 695, 100 )
|
||||
WindowSetBackgroundColor( _window, fn ColorWhite )
|
||||
text @"Menlo", 14.0, fn ColorRed
|
||||
|
||||
begin globals
|
||||
CFStringRef gInterval( _height, _width )
|
||||
end globals
|
||||
|
||||
local fn Init
|
||||
NSInteger i, j
|
||||
|
||||
for i = 0 to _height - 1
|
||||
for j = 0 to _width - 1
|
||||
gInterval( i, j ) = @"◼︎"
|
||||
next
|
||||
next
|
||||
end fn
|
||||
|
||||
local fn CantorSet( start as NSInteger, length as NSInteger, index as NSInteger )
|
||||
NSInteger i, j, segment = length / 3
|
||||
|
||||
if segment == 0 then exit fn
|
||||
for i = index to _height - 1
|
||||
for j = start + segment to start + segment * 2 - 1
|
||||
gInterval( i, j ) = @" "
|
||||
next
|
||||
next
|
||||
fn CantorSet( start, segment, index + 1 )
|
||||
fn CantorSet( start + segment * 2, segment, index + 1 )
|
||||
end fn
|
||||
|
||||
NSInteger i, j
|
||||
|
||||
fn Init
|
||||
fn CantorSet ( 0, _width, 1 )
|
||||
for i = 0 to _height - 1
|
||||
for j = 0 to _width - 1
|
||||
print gInterval( i, j );
|
||||
next
|
||||
print
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue