# Framework for the draw_tree function.
#
# Note: this file will not load until the "..." bits are replaced.

def draw_tree(tree)
  width = 7           # works for trees up to depth 2
  image = empty_image(width)
  depth = 0
  start = 0
  finish = width-1
  draw_tree_helper(tree,image,depth,start,finish)
  plot(image,20)
end

def draw_tree_helper(tree,image,depth,start,finish)
  puts "tree=#{tree.inspect} depth=#{depth} start=#{start} finish=#{finish}"
  mid = (start + finish) / 2
  # draw the current node
  image[depth][mid] = [255,0,0]
  if tree.kind_of?(Array) then
    # recursively draw the children:  FILL IN THE "..." PART
    draw_tree_helper(tree[0], ...)
    draw_tree_helper(tree[1], ...)
  end
end
