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++
- Host: GitHub
- URL: https://github.com/azimjohn/minesweeper
- Owner: azimjohn
- Created: 2021-06-11T10:12:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-23T19:32:23.000Z (over 4 years ago)
- Last Synced: 2023-08-29T16:41:46.193Z (over 2 years ago)
- Topics: cpp, sfml, university-project
- Language: C++
- Homepage:
- Size: 53.7 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
};
```