Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minesweeper

A browser-based Minesweeper game implementation built with vanilla JavaScript.

Overview

This is a sandbox project for exploring GitHub Copilot features while building a classic Minesweeper game. The game features a clean, modern interface and supports multiple difficulty levels.

Features

  • Classic Minesweeper gameplay
  • Left-click to reveal cells
  • Right-click to place/remove flags
  • Auto-reveal adjacent cells when clicking on empty cells
  • Win/lose detection
  • Visual feedback with emojis and colors
  • Player Listeners: Add custom JavaScript code that responds to game events
    • Create, update, and delete listeners through the UI
    • Real-time code validation with helpful error messages
    • Color-coded feedback (green for success, red for errors)

Project Structure

minesweeper/
├── index.html          # Main HTML file with game layout and structure
├── style.css           # Game styling and visual design
├── minesweeper.js      # Game logic and interaction handling
├── README.md           # Project documentation (this file)
└── CONTRIBUTING.md     # Guidelines for contributors

Getting Started

Running the Game

Simply open index.html in a web browser. No build process or dependencies required!

# Using Python 3
python -m http.server 8000

# Using Node.js (if you have http-server installed)
npx http-server

# Or just open the file directly
open index.html  # macOS
start index.html # Windows

Then navigate to http://localhost:8000 in your browser.

How to Play

  1. Reveal cells: Left-click on a cell to reveal it
  2. Place flags: Right-click on a cell to mark it as a mine
  3. Win: Reveal all non-mine cells
  4. Lose: Click on a mine

Game Rules

  • Numbers indicate how many mines are adjacent to that cell (including diagonals)
  • Empty cells (0 adjacent mines) automatically reveal their neighbors
  • You can flag cells you think contain mines
  • The game ends when you either:
    • Reveal all non-mine cells (WIN)
    • Click on a mine (LOSE)

Code Organization

The project follows a modular structure:

minesweeper.js

The main game logic is organized into clear sections:

  1. Minesweeper Class: Core game logic

    • Board initialization and mine placement
    • Cell rendering and visual updates
    • User interaction handlers
    • Game state management
  2. Global Functions: Game control functions

    • startNewGame(): Initializes a new game instance
  3. Event Listeners: User interaction setup

    • Page load initialization
    • Button click handlers

For detailed code organization and contribution guidelines, see CONTRIBUTING.md.

Development

For Contributors

If you're contributing to this project, especially when multiple PRs are active, please read CONTRIBUTING.md for:

  • Code organization guidelines
  • Merge conflict resolution strategies
  • Best practices for concurrent development
  • Section markers for easy navigation

Current Development Focus

The project is actively being enhanced with:

  • Game configuration options (difficulty levels)
  • API for building assistants
  • Advanced gameplay features (flag-based cell opening)
  • Better documentation for agents and humans

Browser Compatibility

This game works in all modern browsers that support:

  • ES6 JavaScript (classes, arrow functions, template literals)
  • CSS Grid
  • DOM Event listeners

Tested on recent versions of:

  • Chrome
  • Firefox
  • Safari
  • Edge

License

This project is for educational and demonstration purposes.

Acknowledgments

Built as a sandbox for exploring GitHub Copilot capabilities.

About

sandbox for playing with github copilot

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages