An open API service indexing awesome lists of open source software.

https://github.com/azimjohn/minesweeper

Minesweeper Game - in C++
https://github.com/azimjohn/minesweeper

cpp sfml university-project

Last synced: about 1 year ago
JSON representation

Minesweeper Game - in C++

Awesome Lists containing this project

README

          

# Minesweeper 💣
Minesweeper Game - in C++

### Definition of `Cell`
```cpp
// cell.h

struct cell_t {
private:
bool is_mine = false;
bool is_flagged = false;
bool is_revealed = false;
int adjacent_mines = 0;

public:
cell_t();
~cell_t();
void place_mine();
bool reveal();
void toggle_flag();
void unflag();
void increment_adjacent_mines();
bool auto_reveal();
bool auto_reveal_neighbors();
char get_display_value();
void reset();
};
```

### Definition of `Board`
```cpp
// board.h

struct board_t {
private:
int width;
int height;
cell_t ***cells;

public:
board_t(int W, int H);
~board_t();
void reset();
void place_mines(int count);
void place_mine(unsigned int row, unsigned int col);
void reveal_cell(unsigned int row, unsigned int col);
void reveal_all_cells();
void toggle_flag_cell(unsigned int row, unsigned int col);
void draw(sf::RenderWindow* window, TextureManager *textureManager, int cell_size);
vector > get_adjacent_positions(unsigned int row, unsigned int col);
};
```