Evgenii-Bazhaov / Hacktoberfest2024

Make your first Pull Request on Hacktoberfest 2024. Don't forget to spread love and give us a ⭐️
https://hacktoberfest2024-nu.vercel.app
GNU General Public License v3.0
62 stars 250 forks source link

Pull Request: Create Minesweeper.java: Add GUI-Based Minesweeper Game #343

Closed KSVeerendernath closed 3 weeks ago

KSVeerendernath commented 3 weeks ago

Pull Request: Add GUI-Based Minesweeper Game

Description

This pull request introduces a GUI-based Minesweeper game implemented in Java (Adding a new game called Minesweeper in java), complete with an interactive interface that allows players to reveal cells, flag potential mines, and attempt to clear the board without triggering a mine. This addition brings a visually engaging version of the classic game to the project.

Features Added

  1. Interactive 9x9 Game Board:

    • A 9x9 grid with 10 randomly placed mines, following the traditional Minesweeper format.
    • Players can click to reveal cells or right-click to flag suspected mines.
  2. Emoji Enhancements:

    • Mines: Mines are displayed as "*" emojis when revealed after a game loss, adding visual feedback.
    • Flagged Cells: Players can mark suspected mines with a "..." by right-clicking on a cell, enhancing the visual appeal of flagged cells.
  3. Game Mechanics:

    • Cell Revealing: Reveals adjacent cells automatically if a cell has no neighboring mines.
    • Flagging Feature: Right-click to toggle flags on cells, allowing players to mark suspected mines.
    • End Game Logic: Alerts for win or loss conditions, displaying all mines upon game over.
  4. User Interaction:

    • Players use the mouse for cell actions:
      • Left-click to reveal a cell.
      • Right-click to flag/unflag a cell as a suspected mine.

Visual Enhancements

How to Play

  1. Left-click to reveal a cell. If it’s a mine, the game ends with a "Game Over" message.
  2. Right-click to flag/unflag cells as suspected mines using the "..."
  3. The game ends when all non-mine cells are revealed, displaying a "Congratulations" message.

Testing & Verification

This Minesweeper game adds an interactive and visually pleasing experience, and its simplicity makes it a great addition to introduce beginners to GUI programming in Java.

We have also raised an issue for this.

Please let me know if you need any other additional information to accept our PR.

As mentioned in the issue description We are master’s students (@KSVeerendernath, @manutopp, @gurramtejaswini) working on this project as part of our coursework, which requires us to contribute to an open-source repository. We've chosen to add Minesweeper to this project to demonstrate our skills and bring a new, fully functional game to the repository

KSVeerendernath commented 3 weeks ago

Hi @sudhanshu-77 and @Evgenii-Bazhaov, Thank you so much for accepting our PR, we really appreciate your time and quick response!! Kudos. Thanks !!