Skip to content

**Minesweeper Game ๐ŸŽฎ๐Ÿ’ฃ** A fun and challenging Minesweeper game built with JavaScript! Uncover cells, avoid mines, and test your puzzle-solving skills. Created by HichemTab-tech. Contributions and suggestions are welcome! ๐Ÿš€๐Ÿ˜Š

License

Notifications You must be signed in to change notification settings

HichemTab-tech/MinesWeeper-js

Repository files navigation

Minesweeper Game ๐ŸŽ‰

Welcome to the Minesweeper Game! ๐Ÿš€ This is a classic Minesweeper game built with JavaScript, where you can test your puzzle-solving skills and try not to explode! ๐Ÿ’ฃ

How It Works ๐Ÿ› ๏ธ

The game board is a grid of cells, each of which may hide a mine (๐Ÿ’ฃ), a flag (๐Ÿšฉ), or a number (๐Ÿ”ข). The goal is to uncover all the cells without mines. Hereโ€™s how weโ€™ve set it all up:

Game Board ๐Ÿ•น๏ธ

  • Cells Creation: We created a parent <div> and inserted lots of child <div>s representing the cells. Each cell contains:

    • A mine element (๐Ÿ’ฃ)
    • A flag element (๐Ÿšฉ)
    • A number element (๐Ÿ”ข)
  • Visibility: These elements show or hide depending on the map details, revealing what's underneath the cell when clicked.

Game Settings โš™๏ธ

  • Size: The number of cells is based on the selected size:

    • Extra Small: 9x16 grid
    • Small: 16x16 grid
    • Medium: 32x16 grid
    • Large: 48x64 grid (not applicable yet because of performance issues)
    • Extra Large: 100x100 grid (not applicable yet because of performance issues)
  • Difficulty: The density of mines per size depends on the difficulty level:

    • Easy: 10% of cells contain mines ๐ŸŒŸ
    • Medium: 20% of cells contain mines ๐Ÿ’ช
    • Hard: 40% of cells contain mines ๐Ÿ˜ฑ
    • Impossible: 60% of cells contain mines ๐Ÿ”ฅ

Uncovering Cells ๐Ÿ”

Weโ€™ve implemented the Flood Fill Algorithm to determine which squares to uncover when a square is clicked. Hereโ€™s how it works:

  1. Initial Click: When you click on a cell, if it has no neighboring mines (number = 0), the algorithm will start uncovering all adjacent cells recursively until it reaches cells with numbers.
  2. Recursive Uncovering: This ensures that large empty areas are uncovered quickly and efficiently, making the game smoother and more exciting!

Additional Features ๐ŸŽจ

  • Flag Mode: Toggle between uncovering cells and placing flags with a simple click! This helps you mark potential mines and avoid explosions.
  • Timer: A ticking clock to keep you on your toes! โฑ๏ธ We used the TickWatch library by HichemTab-tech to implement the timer.

Contributions and Suggestions ๐Ÿ’ก

Weโ€™re always open to contributions and suggestions! If you have any ideas to improve the game or if you want to contribute to the project, feel free to reach out or create a pull request. Let's make this game even more fun together! ๐ŸŽ‰

Enjoy the Game! ๐ŸŽฎ

We hope you have a blast playing our Minesweeper game! It's designed to be challenging and fun. So, go ahead and see if you can uncover all the cells without hitting a mine. Good luck, and happy sweeping! ๐Ÿงน๐Ÿ’ฃ

Created with โค๏ธ by HichemTab-tech.

About

**Minesweeper Game ๐ŸŽฎ๐Ÿ’ฃ** A fun and challenging Minesweeper game built with JavaScript! Uncover cells, avoid mines, and test your puzzle-solving skills. Created by HichemTab-tech. Contributions and suggestions are welcome! ๐Ÿš€๐Ÿ˜Š

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published