A='A'
B='B'
C='C'
D='D'
E='E'
F='F'
G='G'
H='H'
I='I'
list1=[A,B,C]
list2=[D,E,F]
list3=[G,H,I]
def Output():
print(list1)
print(list2)
print(list3)
Output()
print('The object of Tic Tac Toe is to get three in a row. You play on a three by three game board. The first player is known as X and the second is O. Players alternate placing Xs and Os on the game board until either oppent has three in a row or all nine squares are filled. X always goes first, and in the event that no one has three in a row, the stalemate is called a cat game.')
print()
print('This is a two player game. Single-player Coming soon!')
print()
print('You must place your letter by choosing a letter from above to decide the co-ordinates. The first player starts with X, and the second player starts with O.')
Decision=input('Enter Co-ordinate of First player:')
if Decision == A:
A ='X'
if Decision == B:
B = 'X'
if Decision == C:
C ='X'
if Decision == D:
D ='X'
if Decision == E:
E ='X'
if Decision == F:
F ='X'
if Decision == G:
G ='X'
if Decision == H:
H ='X'
if Decision == I:
I ='X'
Output()
これは私がTic Tac Toe用に書いたコードです。私が座標に入り、出力関数を使用するたびに、文字Xは入力された座標の場所に表示されません。変数で値が置き換えられないのはなぜですか?
おそらく座標にXを割り当てるためのもの、例えば、 ' A = 'X'ではなく、A = 'X'である。 – Reti43
Vivek、@ Reti43で言及されているバグを修正するために質問を編集したことがあります。あなたの問題を解決したか/あなたの質問に答えましたか? – SherylHohman