//exercise 3A
Command square l r
{
line l l r l
line l l l r
line r l r r
line l r r r
}
Command diamond a b half
{
line half a b half
line half a a half
line a half half b
line b half half b
}
Command pattern3A y
{
repeat m 0 10
{
pen (m*y)
set n (m*m*m)
set x n
square x y
|
|
square (x+(y/4)) (y-(y/4))
square ((x+(y/4))+((y/2)-(y/4/2))) ((y-(y/4))-((y/2)-(y/4/2)))
}
}
//exercise 3B
Command pattern3B A
{
forever
{
repeat x 0 50
{
set y (x*A)
set z (x/y)
//paper x
pen (100-x)
line z y (50-z) (50-y)
line (50-y) z y (50-z)
line (50-z) (50-y) z y
line y (50-z) (50-y) z
}
}
}
|
|
// exercise 3C
Command pattern3C incX
{
repeat B 0 100
{
set A (B*incX)
pen A
line A 0 100 A
line A 100 0 A
line 0 A (20-A) 0
pen (100-A)
line 100 (100-A) (100-(60-A)) 100
}
}
repeat x 0 100
{
paper x
pattern3C 5
pattern3A 50
pattern3B 20
}
|