private void checkGameOver()
	{
		int x,y;
		boolean gameOver = false;
		Snake snake = model.getSnake();
		ArrayList<SnakeSegment> tempSnake = snake.getSegments();
		x = tempSnake.get(0).getX();
		y = tempSnake.get(0).getY();
		//Checks whether or not the head of the snake has crashed in
		//to its own body
		for(SnakeSegment s : tempSnake)
		{
			if(s.getX() == x && s.getY() == y && tempSnake.indexOf(s) != 0)
				gameOver = true;
		}
		//Checks whether or not the head of the snake has hit one of the walls
		if(x > model.getFrameLength() || x < 0 || y < 0 || y > model.getFrameHeight())
			gameOver = true;
		
		if(gameOver)
		{			
			timer.stop();
			view.switchPanel(view.getGameOverPanel());
		}
		else
			checkEatApple();
	}