My homework for cs193p assignment #6