擅长:python、mysql、java
<p>有几件事:</p>
<h2>81号线</h2>
<p>不能有两个后续的return语句。第一个将退出函数。如果要返回两组坐标,则返回嵌套列表:</p>
<pre><code>return [[x1, y1], [x2, y2]]
</code></pre>
<h2>161号线</h2>
<p>然后使用解包来获得:</p>
^{pr2}$
<h2>171/176号线</h2>
<p>确保你要经过的两艘船是不同的(目前它们是相同的):</p>
<pre><code>hit = haveShot("1", player2Ship, player2Ship, player1Board)
</code></pre>
<p>到</p>
<pre><code>hit = haveShot("1", p2ship1, p2ship2, player1Board)
</code></pre>
<h2>170号线</h2>
<p><code>while hit == False</code>条件意味着游戏将在玩家1的飞船被击中后立即退出。使用另一个变量检查游戏是否结束,例如:</p>
<pre><code>while player1ShipCount > 0 and player2ShipCount > 0:
#play game
</code></pre>
<p>并跟踪每个玩家的可用飞船。在</p>