Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
44
Task/Peano-curve/FutureBasic/peano-curve.basic
Normal file
44
Task/Peano-curve/FutureBasic/peano-curve.basic
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
_window = 1
|
||||
_curveSize = 7
|
||||
_curveOrder = 3 * 3 * 3 * 3 // 3^4
|
||||
|
||||
void local fn BuildWindow
|
||||
CGRect r = fn CGRectMake( 0, 0, 565, 570 )
|
||||
window _window, @"Peano Curve In FutureBasic", r, NSWindowStyleMaskTitled
|
||||
WindowSetBackgroundColor( _window, fn ColorBlack )
|
||||
end fn
|
||||
|
||||
local fn Peano( x as long, y as long, lg as long, i1 as long, i2 as long )
|
||||
ColorRef color = fn ColorRed
|
||||
|
||||
if ( lg == 1 ) then line to x * _curveSize, y * _curveSize : exit fn
|
||||
lg /= 3
|
||||
|
||||
select ( rnd(8) )
|
||||
case 1 : color = fn ColorBrown
|
||||
case 2 : color = fn ColorRed
|
||||
case 3 : color = fn ColorOrange
|
||||
case 4 : color = fn ColorYellow
|
||||
case 5 : color = fn ColorGreen
|
||||
case 6 : color = fn ColorBlue
|
||||
case 7 : color = fn ColorPurple
|
||||
case 8 : color = fn ColorWhite
|
||||
end select
|
||||
|
||||
pen 2, color
|
||||
fn Peano( x + 2*i1* lg, y + 2*i1* lg, lg, i1, i2 )
|
||||
fn Peano( x + (i1-i2+1)*lg, y + (i1+i2)* lg, lg, i1, 1-i2 )
|
||||
fn Peano( x + lg, y + lg, lg, i1, 1-i2 )
|
||||
fn Peano( x + (i1+i2)* lg, y + (i1-i2+1)*lg, lg, 1-i1, 1-i2 )
|
||||
fn Peano( x + 2*i2* lg, y + 2*(1-i2)* lg, lg, i1, i2 )
|
||||
fn Peano( x + (1+i2-i1)*lg, y + (2-i1-i2)*lg, lg, i1, i2 )
|
||||
fn Peano( x + 2*(1-i1)* lg, y + 2*(1-i1)* lg, lg, i1, i2 )
|
||||
fn Peano( x + (2-i1-i2)*lg, y + (1+i2-i1)*lg, lg, 1-i1, i2 )
|
||||
fn Peano( x + 2*(1-i2)* lg, y + 2*i2* lg, lg, 1-i1, i2 )
|
||||
end fn
|
||||
|
||||
randomize
|
||||
fn BuildWindow
|
||||
fn Peano( 0, 0, _curveOrder, 0, 0 )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue