Error handling and victory/loss conditions