时间复杂度空间复杂度计算
public bool GameOver{
get
{
//游戏已结束
if (gameOver)
{
return true;
}
//如果蛇头碰到蛇身,或者蛇头越过的屏幕边界,则游戏结束
if (snake.IsHeadTouchedBody() ||
snake.Head.X < 0 || snake.Head.X > width ||
snake.Head.Y < 0 || snake.Head.Y > height)
{
gameOver = true;
return true;
}
return false;
}
}
最好有详细过程