Skip to content

Code-Abbey/Minesweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minesweeper Game

A browser-based Minesweeper game built using HTML, CSS, and JavaScript. This project focuses on JavaScript-driven interactivity while keeping the HTML and CSS minimal. The game allows users to reveal tiles, flag mines, and win by uncovering all safe tiles without triggering a mine.


Features

Classic Minesweeper Gameplay – Click to reveal tiles, right-click to flag suspected bombs
Dynamic Grid Size & Difficulty – Players can select grid size and difficulty level
Game State Handling – Displays win/loss messages and final score
User-Friendly Interface – Fully styled with CSS for a modern look
Interactive Home Screen & About Section – Includes game instructions
Sound Effects – Clicks, flagging, explosion, and win/lose sounds


Installation & How to Play

1. How to Run the Game

  • Download the project files
  • Open index.html in any modern browser (Google Chrome, Firefox, etc.)
  • No additional setup is required

2. Game Controls

  • Left-click to reveal a tile
  • Right-click to flag a tile (long-press on mobile)
  • Win Condition: Reveal all safe tiles without hitting a mine
  • Lose Condition: Click on a mine

Development Process

Why Have You Chosen This Pathway?

I chose to develop a Minesweeper game because it is a logic-based game that involves user interaction, DOM manipulation, and event handling, which aligns well with the project requirements. Minesweeper is a well-known classic, and by recreating it, I was able to focus on core JavaScript functionalities like:

  • Handling user interactions (click events, right-click flagging)
  • Dynamically updating the UI without using Canvas
  • Implementing a difficulty system to enhance gameplay
  • Managing state changes (game over, win conditions)

Additionally, I wanted to challenge myself by improving the game's structure with modular JavaScript while keeping the HTML and CSS minimal and functional.

What Did I Learn Through This Process?

Throughout the development process, I gained valuable insights into JavaScript-driven game development. Some key learnings include:

  • DOM Manipulation & Event Handling:
    I deepened my understanding of handling click events dynamically and managing interactions between HTML elements and JavaScript logic.

  • Object-Oriented Programming (OOP) in JavaScript:
    Using a class-based approach, I structured the game efficiently, making it scalable and easier to manage.

  • Game State Management:
    I learned how to track user progress, determine win/lose conditions, and update the UI accordingly.

  • CSS Improvements & Layout Adjustments:
    I optimized the spacing, alignment, and overall layout to make the game visually appealing and user-friendly.

  • Debugging & Testing:
    I encountered and resolved issues like grid not displaying, event listeners not triggering, and ensuring the game resets correctly upon restart.

Conclusion

This project helped me improve my JavaScript skills, particularly in user interaction handling, UI updates, and structuring code efficiently. By following a JavaScript-first approach, I ensured that the game is fully dynamic, responsive, and functional without unnecessary complexity. I also gained a better understanding of game logic, state management, and UX improvements.


Technologies Used

  • HTML5 – Structure of the game
  • CSS3 – Styling and layout improvements
  • JavaScript – Game logic, DOM manipulation, and interactivity

Author

  • Developed by Abiodun Adefusi

About

Browser-based Minesweeper game built with HTML, CSS, and JavaScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors