TheAlgorithms / C

Collection of various algorithms in mathematics, machine learning, computer science, physics, etc implemented in C for educational purposes.
https://thealgorithms.github.io/C
GNU General Public License v3.0
19.2k stars 4.37k forks source link

[FEATURE] Feature Request: Add Text-Based Minesweeper Game in C #1436

Open KSVeerendernath opened 3 days ago

KSVeerendernath commented 3 days ago

Detailed description

We propose to implement a text-based version of the classic Minesweeper game in C. The game will operate in the console, allowing players to uncover cells, flag potential mines, and attempt to clear the board without triggering a mine.

Context

Minesweeper is a well-known puzzle game that challenges players to strategically reveal cells while avoiding hidden mines. This implementation aims to provide an engaging console-based experience that introduces fundamental programming concepts such as data structures, recursion, and user interaction.

Possible implementation

  1. Game Board:

    • A 9x9 grid will represent the game board, containing 10 randomly placed mines.
    • Each cell will either be empty, contain a mine, or display a number indicating adjacent mines.
  2. Core Mechanics:

    • Cell Revealing: Players can reveal cells. If a mine is revealed, the game ends. If a cell is empty and has no adjacent mines, surrounding cells will also be revealed automatically.
    • Flagging Mines: Players can flag cells as suspected mines.
  3. Game Display:

    • The console will display the current state of the board, showing revealed cells with adjacent mine counts or mines, flagged cells, and hidden cells as dots (.).
  4. User Interaction:

    • Players will input their desired row, column, and action (r for reveal, f for flag/unflag), with input validation to ensure valid moves.
  5. End Game Logic:

    • Implement logic to check for winning and losing conditions, displaying appropriate messages at the end of the game.

Additional information

We are master's students @KSVeerendernath @manutopp @gurramtejaswini, and as part of our coursework, we need to contribute to a repository in any way. We have chosen to contribute to this repository by adding a new game. Hope you accept our feature.

This feature will enhance the repository by adding a fully functional game, demonstrating the versatility of C programming and encouraging further contributions from students interested in game development.

Repo link: TheAlgorithms/C
Location: Games Directory

KSVeerendernath commented 1 day ago

Hi @Panquesito7 @tjgurwara99 @alexpantyukhin,

I hope you are all doing well!

We are master's students [@KSVeerendernath @manutopp @gurramtejaswini] from NAU, and as part of our coursework, we need to contribute to a repository in some way. We have chosen to contribute to this [repository] by adding a new game [Feature].

Please consider our request and approve our contribution. We need your approval to inform our professor, so we would greatly appreciate your support in allowing us to proceed with the game development.

Please let me know if you require any further information.

Thanks!!