Generate the complete HTML, CSS, and JavaScript code for a web-based simulation of Conway's Game of Life.
Prompt
Generate the necessary HTML, CSS, and JavaScript to create a functional demonstration of Conway's Game of Life. The application must launch with the "Gosper Glider Gun" pattern pre-loaded and visible on the grid. The simulation must be paused by default, inviting the user to start it. Core Requirements to Fulfill: Technology Stack: Use HTML for structure, CSS for styling, and vanilla JavaScript for all logic. The code should be organized into three distinct files. The Rules of Life: The simulation core must accurately implement the fundamental rules: A live cell with fewer than two live neighbors dies. A live cell with two or three live neighbors lives on. A live cell with more than three live neighbors dies. A dead cell with exactly three live neighbors becomes a live cell. Initial State: The grid must be initialized with the Gosper Glider Gun pattern upon page load. The AI is responsible for knowing or finding the correct pattern for this well-known construct. User Interface and Controls: The interface must be clean and provide the user with essential controls, including the ability to: Start and Pause the simulation. Reset the grid back to the initial Gosper Glider Gun state. Clear the grid to an empty state. Visual Feedback: The state of the grid (live/dead cells) must be clearly rendered. A visible counter should display the current generation number, which updates as the simulation proceeds.
A system prompt was added to support web rendering