Update project2.c

This is the newest version of my code. The result looks pretty good, but I need some time to check its correctness though.