2人のプレイヤーが順番にプレイすることができましたが、2番目のプレイヤーが答えを入力した後に停止します。私はWhileループをやりたいと思っていましたが、私は真剣に考え方がなくなりました。私は2人のプレイヤーが0またはXの3つの位置が満たされるまで演奏を続けたいと思っているように私の心の中に入れますが、コードに入れておくと本当に助けが必要です。どうすればいいですか?多くの条件を満たすループがありますか?#
は、以下の私の状態ですが、私はこれらの条件は、(3つの要素ごとに)
if list1[0,1,2] == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [0] , list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [1], list3[2]) == 'x':
print ('Congrats! x won!')
elif (list2 [0] , list2 [1], list2[2])== 'x':
print ('Congrats! x won!')
elif (list3 [0] , list3 [0], list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1 [1] , list2 [1], list3[1]) == 'x':
print ('Congrats! x won!')
elif (list1 [2] , list2 [2], list3[2]) == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [1], list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1 [1] , list2 [1], list3[1]) == 'x':
print ('Congrats! x won!')
elif (list1 [2] , list2 [2], list3[2]) == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [0], list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1[0,1,2] == 'o':)
print ('Congrats! o won!')
elif (list1 [0] , list2 [0] ,list3[0]) == 'o':
print ('Congrats! o won!')
elif (list1 [0] , list2 [1], list3[2]) == 'o':
print ('Congrats! o won!')
elif (list2 [0] , list2 [1], list2[2]) == 'o':
print ('Congrats! o won!')
elif (list3 [0] , list3 [0], list3[0]) == 'o':
print ('Congrats! o won!')
elif (list1 [1] , list2 [1], list3[1]) == 'o':
print ('Congrats! o won!')
elif (list1 [2] , list2 [2], list3[2]) == 'o':
print ('Congrats! o won!')
elif (list1 [0] , list2 [1], list3[0]) == 'o':
print ('Congrats! o won!')
elif (list1 [1] , list2 [1], list3[1]) == 'o':
print ('Congrats! o won!')
elif (list1 [2] , list2 [2], list3[2]) == 'o':
print ('Congrats! o won!')
elif (list1 [0] , list2 [0], list3[0]) == 'o':
print ('Congrats! o won!')
else
待ちは、3列の三目並べ、そしてあなたがしているということです誰かが勝ったかどうかを調べる –
異なるオブジェクトを比較しているため、あなたの条件は真になりません。私は[pythonチュートリアル](https://docs.python.org/2/tutorial/) –
をご覧になることをお勧めします。はい、私は3つのリストを使用しました。 list1、list2、list3 – sarah