How farvejfaru/simon-game works
Main Components
• UI Layer (index.html): This file provides the structure for the game interface, including the game board and buttons.
• Styling Layer (style.css): This file handles the visual design and animations, such as button flashing effects.
• Game Logic Layer (script.js): This contains the core logic, including event listeners, random sequence generation, user input handling, game state management, and resetting the game.
Out the Interactions
• User Response: When the user clicks a button, the data flows from the UI Layer back to the Game Logic for verification.
• Game State Management: The Game Logic then checks if the user’s input matches the expected sequence, updates the game state, and either continues the game by extending the sequence or resets the game state on error.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly separate the layout/markup (HTML), style/animation (CSS), and application logic (JavaScript).
• Event-Driven Programming: Emphasize the use of event listeners in script.js that respond to user actions.
• User Feedback Loop: Show the cyclical process where the UI updates (with CSS animations) based on the game logic's decisions and user actions.