期中測驗
Load dbngraphics.dbn
size 500 400
paper 50 205 50
fast
//left
fast
//小圓
repeat a 0 30
{
circle 120 200 a 100
}
fast
//大圓
repeat a 30 80
{
circle 120 200 a 0
}
fast
//大圓外圈
repeat a 80 85
{
circle 120 200 a 100
}
fast
repeat a 80 160
{
pen 225 34 34
triangle 80 30 120 210 a 30
}
repeat a 50 190
{
pen 50 200 80
triangle 50 300 120 210 a 300
}
repeat a 200 240
{
pen 139 0 0
triangle 200 40 221 100 a 40
}
repeat a 195 245
{
pen 100
triangle 195 100 221 150 a 100
}
repeat a 189 250
{
pen 80
triangle 189 150 221 200 a 150
}
repeat a 30 95
{
pen 240 215 20
rectangle 30 350 a 365
}
//right
command circle solid cx cy radius r g b
{
//讓 Y 軸值反轉
set cy (400-cy)
pen r g b
set x 0
set y radius
set d (1-radius)
//circlepixels cx cy x y
// 707/1000 approximates square root of 0.5 = cos(45)
repeat x 0 (radius*707/1000)
{
set tempd d
smaller? tempd 0
{
set d (d+(2*x)+3)
}
notsmaller? tempd 0
{
set d (d+(2*(x-y))+5)
set y (y-1)
}
same? solid 0
{
line (cx+x) (cy+y) (cx+x) (cy+y)
line (cx+y) (cy+x) (cx+y) (cy+x)
line (cx+y) (cy-x) (cx+y) (cy-x)
line (cx+x) (cy-y) (cx+x) (cy-y)
line (cx-x) (cy-y) (cx-x) (cy-y)
line (cx-y) (cy-x) (cx-y) (cy-x)
line (cx-y) (cy+x) (cx-y) (cy+x)
line (cx-x) (cy+y) (cx-x) (cy+y)
}
notsame? solid 0
{
line (cx+x) (cy+y) (cx+x) (cy-y)
line (cx-x) (cy+y) (cx-x) (cy-y)
line (cx-y) (cy+x) (cx+y) (cy+x)
line (cx-y) (cy-x) (cx+y) (cy-x)
}
}
}
circle 1 375 62 58 100 0 0
circle 1 367 40 72 64 220 54
circle 1 367 30 58 205 155 29
circle 1 360 9 75 64 220 54
repeat a 140 370
{
pen 178 34 34
triangle 255 140 370 a 370 370
}
repeat a 371 445
{
pen 85 107 47
triangle 371 200 371 240 a 200
}
repeat a 371 445
{
pen 150 26 26
triangle 371 240 a 240 445 200
}
repeat a 371 465
{
pen 0
rectangle 371 180 a 190
}
repeat a 371 405
{
pen 255 215 0
triangle 371 152 371 173 a 173
}
repeat a 371 398
{
pen 150 26 26
triangle 371 140 371 153 a 153
}
repeat a 417 450
{
pen 100
triangle 417 162 a 162 433 130
}
repeat a 290 470
{
pen 255 69 0
triangle 290 129 380 38 a 129
}
//右下圓
repeat a 0 30
{
pen 50 205 50
rectangle (290+a) (0+a) (470-a) (15-a)
}
//斜四邊形
repeat a 0 30
{
pen (100-(a/2)) 0 0
line (262+a) (302-(a/2)) (280+a) (330-(a/2))
}
repeat a 0 10
{
circle 400 0 (a+70) (80)
}
repeat a 0 30
{
pen 50 205 50
rectangle (309+a) (0+a) (491-a) (15-a)
}