Homework assignment 2 for UC Berkeley CSC 169