擅长:python、mysql、java
<p>对于检查领带,最好检查未归档元素的第一种情况。这样做将允许您在确定支票不是平局时立即停止支票。用另一种方法做需要每次迭代整个电路板。你知道吗</p>
<pre><code>def checkfortie():
for row in board:
for square in row:
if square == 0:
return False # once you have found a single tile not filled, you can stop checking
return True # loop completed without finding an open tile
if checkfortie():
print("It's a tie")
</code></pre>