I've been trying to make a very basic ASCII game in Python, where it randomises a room (with a few things in it) and then you can move around the room. It's probably very inefficient but I've been using a list to store the room layout data, and then a function to print it in the fashion I want. However, for a reason I don't understand, the entire list gets cleared after I draw the room once. My code is as such:
import pygame
from pygame import *
pygame.init()
gridSize = 5
grid1=["@","D","E"]
for i in range((gridSize**2)-3):
grid1.append("~")
random.shuffle(grid1)
def showGrid():
grid2=grid1
for i in range(gridSize):
line=""
for i in range(gridSize):
line+=grid2[0]
del grid2[0]
print(line)
print("\n")```