DBN 01

DBN01 source code:

// enter program
Command paperC rref gref bref
{
set r (rref*100/255)
set g (gref*100/255)
set b (bref*100/255)
paper r g b
}

Command penC rref gref bref
{
set r (rref*100/255)
set g (gref*100/255)
set b (bref*100/255)
pen r g b
}

size 401 401
paperC 105 66 81

Command compare xref yref
{
smaller? xref 7
{
smaller? yref 7
{
pen (((14-xref)*(14-yref)*5/6)-42)
}
notsmaller? yref 7
{
pen (((14-xref)*yref*5/6)-42)
}
}
notsmaller? xref 7
{
smaller? yref 7
{
pen ((xref*(14-yref)*5/6)-42)
}
notsmaller? yref 7
{
pen ((xref*yref*5/6)-42)
}
}
}

Repeat x 1 10
{
Repeat y 1 10
{
penC 194 166 159

set L (40*x-40)
set B (40*y-40)
set R (40*x)
set T (40*y)
set U 7

line L B R B
line R B R T
line R T L T
line L T L B

line (L+U) (B+U) (R-U) (B+U)
line (R-U) (B+U) (R-U) (T-U)
line (R-U) (T-U) (L+U) (T-U)
line (L+U) (T-U) (L+U) (B+U)

line (L+1) (B+1) (R-1) (B+1)
line (R-1) (B+1) (R-1) (T-1)
line (R-1) (T-1) (L+1) (T-1)
line (L+1) (T-1) (L+1) (B+1)
}
}

Repeat x 1 20
{
Repeat y 1 20
{
penC 104 93 91

set L (20*x-20)
set B (20*y-20)
set R (20*x)
set T (20*y)
set U 3

line L B R B
line R B R T
line R T L T
line L T L B

line (L+U) (B+U) (R-U) (B+U)
line (R-U) (B+U) (R-U) (T-U)
line (R-U) (T-U) (L+U) (T-U)
line (L+U) (T-U) (L+U) (B+U)
}
}

Repeat x 1 13
{
Repeat y 1 13
{
compare x y

set L (30*x-20)
set B (30*y-20)
set R (30*x)
set T (30*y)
set U 4

line L B R B
line R B R T
line R T L T
line L T L B

line (L+U) (B+U) (R-U) (B+U)
line (R-U) (B+U) (R-U) (T-U)
line (R-U) (T-U) (L+U) (T-U)
line (L+U) (T-U) (L+U) (B+U)
}
}

0 Responses to "DBN 01"

Post a Comment