From 73fc45c36c3fe406b1f990a604a00fd3dd99435d Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Tue, 7 Mar 2023 23:31:29 -0500 Subject: [PATCH] [O] Make snow particles mutable --- tngame/telnet.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tngame/telnet.py b/tngame/telnet.py index b1b8135..86eaf95 100644 --- a/tngame/telnet.py +++ b/tngame/telnet.py @@ -1,5 +1,7 @@ import asyncio import os +import random +from dataclasses import dataclass from typing import NamedTuple import telnetlib3 @@ -21,20 +23,21 @@ ASCII_HEIGHT = ASCII_CAT.count('\n') ASCII_WIDTH = max(len(line.strip('\n')) for line in ASCII_CAT.splitlines()) -COLORS = {RGB.from_hex(v) for v in { +COLORS = [RGB.from_hex(v) for v in { '#FFFFFF', '#F6AAB7', '#55CDFD' -}} +}] # Snow fall data structure -class SnowParticle(NamedTuple): +@dataclass +class SnowParticle: x: int # x position y: int # y position xv: int # x velocity yv: int # y velocity - color: RGB + color: RGB # color async def shell(reader: TelnetReaderUnicode, writer: TelnetWriterUnicode):