20 lines
525 B
Python
20 lines
525 B
Python
import sys
|
|
from typing import List
|
|
|
|
def diff(last: List[List[bool]], current: List[List[bool]]) -> List[List[bool]]:
|
|
out = []
|
|
for i, row in enumerate(current):
|
|
out.append([])
|
|
for j, pixel in enumerate(row):
|
|
out[i].append(pixel != last[i][j])
|
|
return out
|
|
|
|
def print_frame(pixels: List[List[bool]]):
|
|
p = "\033[H\033[J"
|
|
for y in range(res[1]):
|
|
for x in range(res[0]):
|
|
p += "##" if pixels[y][x] else " "
|
|
p += "\n"
|
|
sys.stdout.write(p)
|
|
|
|
res = (32, 32) |