-4

Didn't know how to correctly write the title, so i will try to explain it here. I am making a game, similar to tic tac toe. The play field is 4x4 and i am saving it as an array. I want to make changes in the array during the game, but it will not print out the array each time, rather it makes changes statically. Lets say at the beginning i print out the whole field and under it the user is asked to type a position. He gives it and the changes are being done in the first printed playfield, without calling it again in the shell. Kinda sloppy explanation, sorry about that.

play_field = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]

def print_playfield():
   for rows in play_field:
       print(*['{:<4}'.format(each) for each in rows])

This is the function, which will display the playfield.I've done it with tkinter already, wanna try it without.

ingofreyer
  • 1,086
  • 15
  • 27
zauahiri
  • 15
  • 6

1 Answers1

0

You could try using the curses module

https://docs.python.org/3/library/curses.html

Alex Zisman
  • 411
  • 2
  • 9