Skip to content

LuYee6813/CS1010301-MineSweeper-Project

 
 

Repository files navigation

CS1010301-MineSweeper-Project

111.2 CS1010301 物件導向程式設計實習 踩地雷遊戲.
MineSweeper game with GUI supported, writing in C++.
截圖 2023-04-23 上午7 55 57

Support Platforms

  • Windows MSVC
  • MacOS AppleClang
  • Linux GCC/Clang

⚠️ Apple Silicon (arm64) is not currently supported.

Build

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .

Run Mode

The game support in console mode and GUI mode.
We can use launch arguments to run the game in different mode.
By default run the game it running in GUI mode.

Command Input

./MineSweeper CommandInput

Command File

./MineSweeper CommandFile <InputCommandFile> <OutputResultFile>

GUI

./MineSweeper GUI

Game State

image

  • Standby
  • Playing
  • GameOver

Command

Command Usage Standby Playing GameOver
Load Load game board
StartGame Start game
Print Print the information
LeftClick Left click a block (Uncover block)
RightClick Right click a block (Put flag)
Replay Start a new game
Quit Quit game

Load

Load <Load Mode...>

Load Mode

BoardFile

Load the generated board file

Load BoardFile <file_path>
Example
Load BoardFile ./boards/board1.txt
RandomCount

Generate a board with random count mines

Load RandomCount <width> <height> <mines_count>
Example
Load RandomCount 10 10 10
RandomRate

Generate a board with random rate mines

Load RandomRate <width> <height> <mines_rate>
Example
Load RandomRate 10 10 0.3

Print

Print <Print Mode...>

Print Mode

GameBoard

Current game board

  • Covered block #
  • Uncovered block number
  • Flag f
  • Question Mark ?
  • Mine X
Example Input
Print GameBoard
Example Output
0 0 0 0 0 0 0 0 1 # 
0 0 0 0 0 0 0 0 1 1 
1 1 1 0 0 0 0 0 0 0 
# f 1 0 1 1 2 1 1 0 
1 1 1 0 1 # ? # 2 1 
0 0 0 0 1 1 # # # # 
0 0 0 0 0 1 # # # # 
0 0 0 0 1 2 # # # # 
1 2 1 1 1 # # # # # 
# # # # # # # # # # 
GameAnswer
Example Input
Print GameAnswer
Example Output
0 0 0 0 0 0 0 0 1 X 
0 0 0 0 0 0 0 0 1 1 
1 1 1 0 0 0 0 0 0 0 
1 X 1 0 1 1 2 1 1 0 
1 1 1 0 1 X 2 X 2 1 
0 0 0 0 1 1 2 1 2 X 
0 0 0 0 0 1 1 1 1 1 
0 0 0 0 1 2 X 1 0 0 
1 2 1 1 1 X 3 2 0 0 
X 2 X 1 1 2 X 1 0 0 
GameState

Current game state (Standby/Playing/GameOver).

BombCount

Current bomb(mines) count in the board.

FlagCount

Current flags count in the board.

OpenBlankCount

Current uncovered block count in the board.

RemainBlankCount

Current covered block count in the board.

Screenshoot

Console

截圖 2023-04-26 上午11 33 46

GUI

截圖 2023-04-23 上午7 54 53

截圖 2023-04-23 上午7 55 57

截圖 2023-04-23 上午7 54 26

截圖 2023-04-23 上午7 54 26

截圖 2023-04-23 上午7 55 24

截圖 2023-04-23 上午7 55 15

截圖 2023-04-23 上午7 54 38

Demo Video

Watch on YouTube

About

111.2 CS1010301 物件導向程式設計實習 踩地雷遊戲

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 73.5%
  • JavaScript 16.2%
  • CMake 6.1%
  • CSS 2.9%
  • HTML 1.3%