new: dev: initialize the GTK client #11
This commit is contained in:
90
gtk-client/mineseeker/constants.py
Normal file
90
gtk-client/mineseeker/constants.py
Normal file
@@ -0,0 +1,90 @@
|
||||
"""
|
||||
This file is part of the SplendidBear Websites' projects.
|
||||
|
||||
Copyright (c) 2026 @ www.splendidbear.org
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
"""
|
||||
|
||||
# Grid dimensions
|
||||
GRID_ROWS: int = 16
|
||||
GRID_COLS: int = 16
|
||||
GRID_SIZE: int = GRID_ROWS * GRID_COLS # 256
|
||||
|
||||
# Game rules
|
||||
TOTAL_MINES: int = 51
|
||||
WIN_THRESHOLD: int = 26 # first player to reach this wins
|
||||
|
||||
# Cell pixel size in the grid widget (each cell rendered as a square)
|
||||
CELL_SIZE: int = 40
|
||||
|
||||
# Player colours (match backend "red" / "blue" strings)
|
||||
PLAYER_RED: str = "red"
|
||||
PLAYER_BLUE: str = "blue"
|
||||
|
||||
# Bomb reveal diamond half-width (matches PHP getBombRadius / JS bombRadius)
|
||||
BOMB_RADIUS: int = 2
|
||||
|
||||
# Heartbeat interval in milliseconds (mirrors JS 1500 ms)
|
||||
HEARTBEAT_INTERVAL_MS: int = 1500
|
||||
|
||||
# SSE reconnect back-off (seconds)
|
||||
SSE_RECONNECT_INITIAL: float = 1.0
|
||||
SSE_RECONNECT_MAX: float = 30.0
|
||||
|
||||
# Bonus stat display labels (mirrors JS BONUS_LABELS)
|
||||
BONUS_LABELS: dict[str, str] = {
|
||||
"blindHits": "Blind Hits",
|
||||
"chainBest": "Best Chain",
|
||||
"chainCurrent": "Current Chain",
|
||||
"lastMineHits": "Endgame Mines",
|
||||
"edgeMines": "Edge Mines",
|
||||
"biggestReveal": "Biggest Reveal",
|
||||
}
|
||||
|
||||
# Image URL path fragments served from BASE_URL/images/
|
||||
IMAGE_NAMES: list[str] = [
|
||||
"bg-target-outbg.png",
|
||||
"bg-bomb-outbg.png",
|
||||
"bg-bomb-disabled-outbg.png",
|
||||
"bg-bomb-exploded-outbg.png",
|
||||
"bg-bomb-empty-outbg.png",
|
||||
"bg-left-mine-outbg.png",
|
||||
"bg-cursor-red-outbg.png",
|
||||
"bg-cursor-blue-outbg.png",
|
||||
"bg-figure-red-outbg.png",
|
||||
"bg-figure-blue-outbg.png",
|
||||
"bg-flag-red-outbg.png",
|
||||
"bg-flag-blue-outbg.png",
|
||||
"bg-last-red-outbg.png",
|
||||
"bg-last-blue-outbg.png",
|
||||
"bg-wave-1-outbg.png",
|
||||
"bg-wave-2-outbg.png",
|
||||
"bg-corner-outbg.png",
|
||||
"bg-bomb-top-left-outbg.png",
|
||||
"bg-bomb-top-center-outbg.png",
|
||||
"bg-bomb-top-right-outbg.png",
|
||||
"bg-bomb-middle-left-outbg.png",
|
||||
"bg-bomb-middle-center-outbg.png",
|
||||
"bg-bomb-middle-right-outbg.png",
|
||||
"bg-bomb-bottom-left-outbg.png",
|
||||
"bg-bomb-bottom-center-outbg.png",
|
||||
"bg-bomb-bottom-right-outbg.png",
|
||||
]
|
||||
|
||||
# Sound file names served from BASE_URL/sound/
|
||||
SOUND_NAMES: list[str] = [
|
||||
"click.mp3",
|
||||
"bomb.mp3",
|
||||
"mine.mp3",
|
||||
"warning.mp3",
|
||||
"won.mp3",
|
||||
"starting.mp3",
|
||||
]
|
||||
|
||||
# Bomb position image name helper
|
||||
# horizontal: "top" | "middle" | "bottom"
|
||||
# vertical: "left" | "center" | "right"
|
||||
def bomb_pos_image(horizontal: str, vertical: str) -> str:
|
||||
return f"bg-bomb-{horizontal}-{vertical}-outbg.png"
|
||||
Reference in New Issue
Block a user