# Your name(s): 
#
# Warmup table
# total upper lower upperY  lowerY
#   8     3     5     -25     +15
#   8     6     2     -10     +30
#   8     4     4       
#   8     7     1       
#   7     3     4       
#   7     1     6       
#   n     a     b       

from samples import *
import turtle
import math

#=========== some utility functions we've written =============
def leafCount(tree):
    """Return number of leaves of the tree."""
    root,first,second = tree    # unpack the tuple
    if first == second == ():
        return 1              # tree with one node
    else:
        return leafCount(first) + leafCount(second)

def reset():
    """Reset the state of the turtle canvas and position."""
    turtle.clear()
    turtle.up()
    turtle.goto(30-0.5*turtle.window_width(), 0)
    turtle.down()
    turtle.setheading(0)

def savePostscript(filename):
    turtle.getscreen().getcanvas().postscript(file=filename)
#==============================================================


def draw1(tree, xScale, yScale):
    """Draw the tree centered to the right of the current position,
    such that leaves end up separated vertically by yScale,
    and levels separated horizontally by xScale.
    """
    # we will start you out by naming the tree pieces and drawing the label

    root,first,second = tree
    turtle.write((root), font=("Arial", 12, "normal"))

    # you must do the rest...


def draw2(tree, xScale, yScale):
    """Draw the tree centered to the right of the current position,
    such that leaves end up separated vertically by yScale,
    and levels separated horizontally by xScale times the distance measures..
    """
    pass   # you must do the rest...
