How ali-jazbi/guess-the-number works
Project type and purpose
• This is a lightweight, front-end–only web application: a static “Guess My Number” game.
• Purpose: Teach and reinforce basic JavaScript, DOM manipulation, and CSS styling by providing interactive feedback to the user as they guess a random number (1–20).
File structure
• index.html – the single HTML entry point, defines the UI skeleton.
• script.js – the entire game logic: random number generation, input validation, score changes, DOM updates.
• No backend, no database, no build steps—just static files served by any web server or GitHub Pages.
README for additional insights
• Confirms it’s a training project from a Udemy course (Jonas Schmedtmann).
• Lists features: random number generation, input validation, score tracker, visual feedback, reset.
• Technology stack: HTML, CSS, JavaScript.
• Deployment: live on GitHub Pages.
a. Main components
• Browser (Client) – where the user plays the game.
• Static Asset Server (e.g., GitHub Pages or any HTTP server) – hosts index.html, style.css, script.js.
• UI Layer – the DOM elements defined in index.html, styled by CSS.
• Game Logic Module – script.js, which:
– Generates a random target number
– Reads user input
– Validates and compares the guess
– Updates score & messages via DOM APIs
– Applies style changes for feedback
b. Relationships & interactions
• User ↔ Browser DOM (typing, clicking “Check!” or “Again!”)
• Browser → Static Asset Server (HTTP GET for HTML/CSS/JS on page load)
• script.js → DOM (querySelector, textContent, style changes)
• script.js (in-memory) ↔ random number generator & score state
c. Architectural patterns / design principles
• Single-page static application (no routing, no backend).
• Separation of concerns: HTML for structure, CSS for style, JS for behavior.
• Event-driven model: user events trigger JS handlers.
d. Key technologies & libraries
• Native browser APIs only (no frameworks).
• CSS transitions and custom properties for visual feedback.
Summary of recommendations
• Related items (e.g., HTML + CSS under “UI Layer”).