class Cell():
y, x = random_pos()
while True:
curses.napms(1000)
scr.clear()
move = random_dir()
if move == "up":
y -= 1
if move == "down":
y += 1
if move == "left":
x -= 1
if move == "right":
x += 1
scr.addstr(y, x, "o")
scr.refresh()
cell = Cell()
cell()
cell()
我希望它能够同时创建to实例,所以它同时创建to单元格。 这是一个生活模拟。
不是100%地实现您想要实现的目标,但是这会创建同一个类的两个单独的实例。
cell1 = Cell()
cell2 = Cell()