GithubHelp home page GithubHelp logo

minesweeper's Introduction

Minesweeper

Author:Alexpon

Environment:Ubuntu 14.10

How to execute: make

./project1.exe

Demand:

*Develop an nondeterministic and interactive game

*Include at least two classes(First, Time)

*Display time (in seconds) on screen

*At least 3 levels of difficulty

*Output the map when the game is over(Mine.txt)

程式解說:

我的程式有兩個class,第一個為First,這是用來製作踩地雷地圖的物件,傳一個選擇難度的值進入First裡的SelectLevel函式,此函式會再將值傳給同物件裡的SetMap函式,做出地圖,並存在boomMap這個array中。另一個class為Time,這個物件是用來計算時間的,main function可藉由call Time物件裡的get function 取得時間,並顯示在遊戲畫面中。在main function裡,大多是ncurses的指令,其中有兩個判斷勝敗的條件式,假如按下Tab開啟地圖時,那一格為炸彈,lose=1會使輸的條件成立,會以紅底黑字印出所有炸彈,再按下任意鍵即會結束遊戲,假如剩餘格數加上插旗數等於炸彈數,即會使勝利條件成立,並印出勝利圖示。

UML:

First

──────────────────────────────────

-sizeRow:int

-sizeCol:int

-boomNum:int

-i:int

-j:int

-count:int

-BoomRow:int

-BoomCol:int

-boomMap[100][100]:char

-num:char

──────────────────────────────────

+First()

+SelectLevel(choose:int):void

+SetMap(col:int, row:int, boom:int):void

+get(y:int, x:int):char

Time

──────────────────────────────────

-start:int

-now:int

-hour:int

-minute:int

-second:int

──────────────────────────────────

+InitialTime():void

+NowTime():void

+Calculate():void

+getHour():int

+getMinute():int

+getSecond():int

minesweeper's People

Contributors

alexpon avatar

Watchers

James Cloos avatar  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.