Hoeteck Wee - Problem Set #2
 
Part 1
p1.dbn
// type program here
Paper 12

Choose a single shade of a paper and render that shade.
 
Part 2
p2.dbn
// becomes brigher and brighter!!
Repeat a 100 0
{
   Paper a
}


Create a sequence of shaded papers using the Repeat command as a short animation of brightness. For example
Repeat a 0 100
{
Paper a
}

 
Part 3
p3.dbn
// white - gray - black rhythm
Repeat c 1 8
{
   Repeat a 0 3
   {
      Paper (a*33)
      Repeat b 1 (130+40*a)
      {
         Line b
      }
   }
}




Create an animation of a sequence of shaded papers that evokes a sense of rhythm.
 
Part 4
p4.dbn
// shades become darker and change
// more slowly with time to evoke
// a tranquil, sleepy image
Repeat a 10 75
{
   Paper a
   Repeat b 1 (a*a/10)
   {
      Pen b
   }
}


Create an animation of a sequence of shaded papers that evokes a tranquil, sleepy image.
 
Part 5
p5.dbn
// black -> white
Repeat a 100 5
{
   Paper a
}
Paper 5
Pen 0
Repeat a 0 50
{
   Line (50+a) (50-a) (50+a) (50+a)
   Line (50-a) (50-a) (50-a) (50+a)
   Line (50-a) (50-a) (50+a) (50-a)
   Line (50+a) (50+a) (50-a) (50+a)
}

Create an animation of a sequence of shaded papers that evokes a gradually increasing/heightening feeling.
 
Part 6
p6.dbn
// A line flies across from the left
// and starts disappearing into
// the right
Paper 75
Pen 0
Repeat a 0 100
{
   Paper 75
   Line a (100-a/5) (2*a) a
}

Add a single line to the sequence, and let it fly in time. For instance
Repeat a 0 100
{
Paper 0
Line a 0 a 100
}

 
Part 7
p7.dbn
// Two lines in contrasting styles:
// One swings anti-clockwise from
// the left; the other bounces.
Paper 75
Pen 0
Repeat a 0 25
{
   Paper 75
   Pen 0
   Line a (100-a/5) (2*a) a
   Pen 0
   Line (100-a) (100-4*a) (120-a) (100-4*a)
}

Repeat a 26 35
{
   Paper 75
   Pen 0
   Line a (100-a/5) (2*a) a
   Pen 0
   Line (100-a) (4*a-100) (120-a) (4*a-100)
}

Repeat a 35 50
{
   Paper 75
   Pen 0
   Line a (100-a/5) (2*a) a
   Pen 0
   Line (100-a) (180-4*a) (120-a) (180-4*a)
}


Repeat a 51 75
{
   Paper 75
   Pen 0
   Line a (100-a/5) (2*a) a
   Pen 10
   Line (100-a) (4*a-200) (120-a) (4*a-200)
}

Repeat a 76 100
{
   Paper 75
   Pen 0
   Line a (100-a/5) (2*a) a
   Pen 10
   Line (100-a) (400-4*a) (120-a) (400-4*a)
}



Add another line and let two lines fly in contrasting styles.
 
Part 8
p8.dbn
// Two lines fly cooperatively from
// the left and start collapsing and
// disappearing into the right
Paper 75
Pen 0
Repeat a 0 90
{
   Paper 75
   Pen (a*(a+200)/320)
   Line a (100-a/5) (2*a) a
   Line (((60-a)/3)+a+a/5) (100-a/5) (2*a-(60-a)/3+a/10) a
}


Let two lines fly in cooperative styles.
 
Part 9
p9.dbn
// Ben wrote:
// -----------------
// paper 50
// repeat a 20 80
// {
//    set [a 65] a
// }
// -----------------
// Here, Ben opted for a colorful
// line. To accentuate the contrast,
// I modifed the paper color to black.
paper 100
repeat a 80 20
{
   set [a 65] a
}



Using Part 1 of Problem Set 1, you are asked to comment and improve on a colleague's work. The person you will choose is determined by your order in the pulldown menu of the main page. For example, Ben should comment on Bruce, Bruce on Nick, and all the way down to Hoeteck commenting on Ben (wrapped around). We don't have a form mechanism setup, so for now just put it inside your DBN buffer as a comment, and include a modified version of your colleague's program that reflects your suggestions.
 
Part 10
p10.dbn
// Ben wrote:
// -----------------
// paper 1
// repeat a 0 50
// {
//    repeat b 0 50
//    {
//       pen ((a+b)/2)
//       line a b (2*a) (2*b)
//    }
// }
// -----------------
// It is pretty amazing how Ben managed
// to produce an image resembling a 3-D
// cube with rounded corners using such
// simple code, though with simplicity,
// the form is compromised.
paper 1
repeat a 0 50
{
   repeat b 0 50
   {
      pen (3*(a+b)/4)
      line a b (2*a) (2*b)
   }
}


Do the same as above for Part 10 of Problem Set 1.