diff options
-rw-r--r-- | app.py | 4 | ||||
-rw-r--r-- | tui/static.py | 14 |
2 files changed, 11 insertions, 7 deletions
@@ -1,3 +1,4 @@ +""" app.py - pääohjelma """ from board.board import Board from tui.tui import Tui, Action @@ -12,7 +13,6 @@ while True: action, x, y = t.matrix_selector(b.get_view(), x, y) match action: case Action.QUIT: - # t.draw_matrix(b.get_view(),-1,-1) print("LOPETUS!") break case Action.OPEN: @@ -20,7 +20,7 @@ while True: t.draw_matrix(b.get_view(), -1, -1) print("KUOLEMA!") break - elif b.is_winning(): + if b.is_winning(): t.draw_matrix(b.get_view(), -1, -1) print("VOITTO!") break diff --git a/tui/static.py b/tui/static.py index c769e0f..cb934f0 100644 --- a/tui/static.py +++ b/tui/static.py @@ -1,7 +1,9 @@ -from enum import Enum +""" tui/static.py - Staattiset määritykset tui:ssa tarvittaville jutuille. """ +from enum import Enum, IntEnum from dataclasses import dataclass class Action(Enum): + """ tominnot, joita voidaan saada palautusrvona """ QUIT = 0 # Pelin lopetus OPEN = 1 # Ruudun avaaminen FLAG = 2 # Ruudun liputus @@ -26,8 +28,9 @@ ActionEscKeys = { @dataclass class TileType: + """ ruututyyppien tallennusmuotojen kuvaus""" text: str # Teksti - colors: [] # Lista (väri, tausta) pareja tekstille + colors: [] # Lista (väri, tausta) pareja tekstin kaunistamiseen TileTypes = { @@ -40,13 +43,14 @@ TileTypes = { 6: TileType( "[6]", [(0x9,0), (0x9,0), (0x9,0)] ), 7: TileType( "[7]", [(0x9,0), (0x9,0), (0x9,0)] ), 8: TileType( "[8]", [(0x9,0), (0x9,0), (0x9,0)] ), - 9: TileType( "[¤]", [(0xF,1), (0xF,1), (0xF,1)] ), + 9: TileType( "[@]", [(0xF,1), (0xF,1), (0xF,1)] ), 10: TileType( "[#]", [(0x8,7), (0x8,7), (0x8,7)] ), 11: TileType( "[B]", [(0x8,7), (0x1,7), (0x8,7)] ), 12: TileType( "[?]", [(0x8,7), (0x3,7), (0x8,7)] ) } -class Colors: +class Colors(IntEnum): + """ ANSI värejä vastaavat lukuarvot """ BLACK = 0 RED = 1 GREEN = 2 @@ -62,4 +66,4 @@ class Colors: BRIGHT_BLUE = 0xC BRIGHT_MAGENTA = 0xD BRIGHT_CYAN = 0xE - BRIGHT_WHITE = 0xF
\ No newline at end of file + BRIGHT_WHITE = 0xF |