How davesides3/spatial-poker works
Project Type and Purpose
• This is a single‐page, browser-based game (Spatial Poker) built with plain HTML, CSS, and JavaScript.
• It has no backend or server-side components; everything runs in the user’s browser.
• Key features:
• A landing page (index.html) and a game page (game.html)
• Styling in two CSS files (index.css and game.css)
• Game logic and audio in a single script (game.js) plus the ZzFX sound generator
File Structure Analysis
• Top level:
• index.html (entry/landing page)
• game.html (the actual game UI)
• index.css, game.css (styles scoped to each page)
• game.js (all game logic, UI updates, and sound calls)
• .glitch-assets (hosted images/fonts if any)
• LICENSE.md, README.md (documentation)
• No server or build scripts—no frameworks—vanilla JS/CSS/HTML only.
• JavaScript orchestrates UI state (cards grid, user inputs) and invokes ZzFX for sound.
a. Main Components to Show
• Browser Host (Chrome/Firefox)
• index.html (Landing Page)
• game.html (Game Shell)
• CSS Engines (index.css, game.css) as Style Layers
• JavaScript Engine (game.js) as Logic Layer
• ZzFX Sound Module (embedded in game.js)
• DOM / UI Grid (Unicode cards rendered as a grid)
• User Input (keyboard events)
• Optional: .glitch-assets (static asset source)
b. Relationships and Data Flow
• User launches index.html → navigates to game.html
• game.html loads game.css + game.js → JS initializes game state
• User presses keys → game.js processes input → updates DOM grid
• game.js triggers ZzFX API calls → audio played
• CSS engine takes updated DOM states → repaints grid/layout
c. Architectural Patterns
• Modular single‐page app: separation of concerns between HTML (structure), CSS (presentation), JS (behavior).
• Event-driven: keyboard events drive the game loop.
• Asset reuse: Unicode characters for cards, lightweight sound generator.
d. Key Technologies
• HTML5 + CSS Grid (for card layout)
• Vanilla JavaScript (ES6 modules or IIFE)
• ZzFX micro-sound library
• Unicode playing cards (no image assets)