Open
Conversation
Co-authored-by: dargmuesli <4778485+dargmuesli@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Tetris game display to web UI
Display Tetris game state in Web UI
Mar 11, 2026
Member
|
Thanks for your contribution! I have a couple remarks:
CC @dargmuesli |
Member
|
@copilot Thanks for your contribution! I have a couple remarks: Block style: The stones are indistinguishable from each other, since every square looks the same. Please align with the style from the pygame version, so blocks can be told apart |
Member
|
@copilot feedback to implement arrived:
|
… feedback Co-authored-by: dargmuesli <4778485+dargmuesli@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Tetris game board was only visible during active gameplay on the touchscreen. This adds a public (no login required) server-side-rendered page at
/tetris/showing the live game state.Changes
blueprints/tetris.py— New blueprint queryingTetrisGame(board, score, level, lines, next/reserve blocks) andTetrisPlayer+Account(player color map). Converts the stored board JSON ([[cell_type, account_id], …]) into{css_class, color}dicts for the template. Includes current-session and all-time scoreboards. O-piece cells emit an additionalcell-oCSS class to distinguish them visually.templates/tetris/index.html— Three-column layout: left sidebar (reserve + next block previews), centre (board grid), right sidebar (stats + scoreboards). Gracefully handles no-game state. Player colours are stored asdata-colorattributes rather than inline styles; vanilla JS reveals them on hover or board click/tap.static/css/tetris.css— CSS-only block rendering matched to the pygame sprite designs:cell-filled): three-layerbackgroundreproducing the outer frame → dark hollow → bright centre dot sprite pattern.cell-filled cell-o): same frame + hollow, centre dot removed — visually distinct from the other tile pieces.cell-i-h1/h2/h3,cell-i-v1/v2/v3): stipple-dotradial-gradienttile with directionalbox-shadowhighlights, replicating the pygame tube texture.repeating-linear-gradientfor a brick pattern.--tetris-cell-sizeCSS variable (default16px) is overridden inside@media (max-width: 600px)tocalc((100vw − 2×padding − 10px) / 12)so the board fills the full viewport width on mobile. Sidebars collapse to a wrapping row.webserver.py— Registers blueprint at/tetris, adds "Tetris" nav entry.Screenshots
Default view (blocks distinguishable by CSS style, player colours hidden):
After clicking the board (player colours revealed):
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.