Added a function to check if the food and snake are overlapping.
Fixed some bugs and added a function to check if the player has lost.