Я новичок ie, ребята, и я написал строку кода в моей игре ti c ta c toe, чтобы напечатать 100 новых строк, чтобы история доски не отображалась, и теперь проблема в том, что строка, в которой написано, чья очередь, не будет показана, потому что осталось 100 строк выше. Я пытался внести некоторые изменения, но безуспешно.
def display_board(board):
print("\n"*100)
print("""
▀█▀ █ █▀▀ ▀█▀ ▄▀█ █▀▀ ▀█▀ █▀█ █▀▀
░█░ █ █▄▄ ░█░ █▀█ █▄▄ ░█░ █▄█ ██▄
█▀▀ ▄▀█ █▀▄▀█ █▀▀
█▄█ █▀█ █░▀░█ ██▄""")
print("\n"*1)
print(board[7]+"|"+board[8]+"|"+board[9])
print("-----")
print(board[4]+"|"+board[5]+"|"+board[6])
print("-----")
print(board[1]+"|"+board[2]+"|"+board[3])
def place_marker(board):
marker = " "
while marker != "x" and marker != "o":
marker = input("Player 1, choose x or o: ")
player1 = marker
if player1 == "x":
player2 = "o"
print("""
|------------------------------------|
| Player 1 is now X and player 2 is O|
|------------------------------------|
""")
else:
player2 = "x"
print("""
|------------------------------------|
| Player 1 is now O and player 2 is X|
|------------------------------------|
""")
#Input of the player
count = 0
for a in range(9):
count += 1
display_board(board)
position = int(input("Choose a number between 1-9: "))
board[position] = marker
if board[1] == board[2] == board[3] != ' ':
win_check = str(board[1] + " HAS WON !!!")
print(win_check)
break
elif board[1] == board[5] == board[9] != ' ':
variabila1 = str(board[1] + " HAS WON !!!")
print(variabila1)
break
elif board[7] == board[8] == board[9] != ' ':
variabila2 = str(board[7] + " HAS WON !!!")
print(variabila2)
break
elif board[7] == board[5] == board[3] != ' ':
variabila3 = str(board[7] + " HAS WON !!!")
print(variabila3)
break
elif board[1] == board[4] == board[7] != ' ':
variabila4 = str(board[1] + " HAS WON !!!")
print(variabila4)
break
elif board[3] == board[6] == board[9] != ' ':
variabila5 = str(board[3] + " HAS WON !!!")
print(variabila5)
break
elif count == 9:
print("THIS IS A TIE")
#if statement pentru a schimba markeru dupa fiecare mutare
if marker =="x":
marker = "o"
print("Now it's (O)'s turn : ")
else:
marker = "x"
print("Now it's (X)'s turn : ")
return(a)
return (player1,player2)
place_marker(board)
#restart function
def clear_board(board):
restart = input("Would you like to play again?:\nyes/no: ")
while restart == "yes":
board = [" "]*10
place_marker(board)
clear_board(board)
else:
restart == "no"
print("Hope you enjoyed it!!!")
if __name__ == "__main__":
clear_board(board)```