Coder Social home page Coder Social logo

luyee6813 / cs1010301-minesweeper-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crt-hao/cs1010301-minesweeper-project

0.0 0.0 0.0 67.46 MB

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

JavaScript 16.20% C++ 73.57% CSS 2.86% HTML 1.28% CMake 6.09%

cs1010301-minesweeper-project's Introduction

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

cs1010301-minesweeper-project's People

Contributors

crt-hao avatar ting-tech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.