first commit from Tan

this is homework from http://www.cs.helsinki.fi/en/courses/582343/2014/s/k/1