// Welding
// This is a combination of parts from assignment 2 and 3.
// The circles are from the "nest" in my solution to problem 3C
// The squares are from the visual glitch prolem 2B
// And the moving, triangle claws are from problem 3A geometric
// progression

// From PS 3C - egg
load dbngraphics.dbn
command nestcircles CX CY R P
{
	circle CX CY R P
      	circle CX CY (R+1) P
        circle CX CY (R+2) P
	circle CX CY (R+3) P
	circle CX CY (R-5) P
	circle CX CY (R-7) P
}

//box command from 139 bo DBN

command box l r t b
{
	repeat a l r
        {
		line a t a b
	}
}

// From PS 2B visual glitch
command row t b
{
	set l 1
        set r 16
	set space 5
	set diff (r-1)
	box l r t b
	box (l+diff+space) (r+diff+space) t b
	box (l+(2*diff)+(2*space)) (r+(2*diff)+(2*space)) t b
	box (l+(3*diff)+(3*space)) (r+(3*diff)+(3*space)) t b
	box (l+(4*diff)+(4*space)) (r+(4*diff)+(4*space)) t b
}

forever
{
        paper 0
        pen 40
        set spaceb 4
        //block
	row (spaceb) (spaceb+15)
	pen 100

        // moving triangle shapes from PS 3A geometric progression
        // This visual element is not put into a command
        // because it is so short and also not used exactly
        // the same way as in PS 3.
        repeat a 4 19
	{
		line 1 a 15 
	}

        pen 40
        row ((2*spaceb)+15) ((2*spaceb) +15+10)

        pen 100
        repeat a 23 33
	{
	        line 20 a 35 
	}

        pen 40
	row ((3*spaceb)+15+10) ((3*spaceb)+15+10+6)

	pen 100
	repeat a 37 43
	{
		line 40 a 54 
	}

	pen 40
	row ((4*spaceb)+15+10+6) ((4*spaceb)+15+10+6+2)

	pen 100
	repeat a 47 49
	{
	       line 60 a 75 
	}

	pen 40
	row ((5*spaceb)+15+10+6+2) ((5*spaceb)+15+10+6+2)

	pen 100
	line 79 53 94 

	row ((6*spaceb)+15+10+6+2) ((6*spaceb)+15+10+6+2+2)
	row ((7*spaceb)+15+10+6+2+2) ((7*spaceb)+15+10+6+2+2+6)
	row ((8*spaceb)+15+10+6+2+2+6) ((8*spaceb)+15+10+6+2+2+6+10)
	row ((9*spaceb)+15+10+6+2+2+6+10) ((9*spaceb)+15+10+6+2+2+6+10+15)
	nestcircles 20 80 25 40
	nestcircles 80 20 20 100

}