Self-Check: Tree Variations

On this page, you will determine what changes to the tree code would produce specific changes to the resulting image.

All of the images in the Self-Check Questions below are based on variations of this recursive tree procedure.

MARY: Images and alt-text need to be redone. --MF, 6/19/20
tree level: (level #) size: (size #){
	if (level=1) {
		move (size) steps
		move(-1*size) steps}
	else{
		move (size) steps
		turn counterclockwise (15) degrees
		tree level: (level-1) size: (size*0.75)
		turn clockwise(15) degrees
		turn clockwise(15) degrees
		tree level: (level-1) size: (size*0.75)
		turn counterclockwise (15)
		move(-1*size) steps
	}
} output of 'tree level: (5) size: (100)' Upwards facing tree with trunk and four levels of branches

  1. Tree with trunk and four levels of branches swaying to the left

    What was changed in the code?

    The turn amount between branches
    The scaling factor (how much the length decreases each time)
    Additional recursive calls to the function and additional turn blocks
  2. Tree with four branches instead of two splitting at each level

    What was changed in the code?

    The turn amount between branches
    The scaling factor (how much the length decreases each time)
    Additional recursive calls to the function and additional turn blocks
  3. Tree with longer and longer branches

    What was changed in the code?

    The turn amount between branches
    The scaling factor (how much the length decreases each time)
    Additional recursive calls to the function and additional turn blocks
  4. Tree with same-size branches

    What was changed in the code?

    The turn amount between branches
    The scaling factor (how much the length decreases each time)
    Additional recursive calls to the function and additional turn blocks
  5. Tree with right angle branches

    What was changed in the code?

    The turn amount between branches
    The scaling factor (how much the length decreases each time)
    Additional recursive calls to the function and additional turn blocks