c++代写 | Master mind Assignment2

本次c++作业是解密一组随机密码。

Assignment 2 Document

 

Project: Master mind

 

How to Play Master Mind

This is the introduction message will be stored in “Rules.txt”:

This is a game that challenges your brain. You need to decipher a random set of passwords.

But don’t worry, the rules of this game are not complicated!

 

  • The system randomly generates a set of numbers at the beginning of the game, They are usually in the following format:

?-?-?-?

Each question mark represents a number between 1-5

 

  • What players should do is to pickup four numbers from 1-5 to form a code as format provided above.
  • Every time player finished his/her guessing, system will come out with a hint that help player doing further decode, for example:

 

If player has guessed a correct number but not in right position

A “?” will be shown up

 

If player has guessed a correct number with right position

A “o” will be shown up

 

  • Repeating guess process and try to match the right code in limited chances, also challenge yourself to decode as less time as possible!

 

 

Development Outline for Master Mind

 

After reading the assignment brief, as it indicated, there are two classes and an application file.

 

The Player Class store the basic data of players, which includes player’s name, scores, total number of wins and number of games played. By having a player class will make the information being update easily and able to store multiple different player’s detail through creating new objects.

 

The Board Class will hold the current game details such as players’ action and provided clues, basically this is a class that associated closely with every time of game.

 

The Application File is a driver that controls the whole game flow, it includes main () function.

 

 

The Game Setup

  • At the beginning of the application there will be a main menu being display, players have to choose one of the options

[A]Play

[B]Read the game rule

[C]Highest score

[D]Quit the game

 

There could be more options in main menu during the developing process

 

  • If player choose option [A] by input “a” or “A

* Ask player for name, a new object of player class will be created.

* Ask player for game level and code length.

* Set every variable associated with game to default and initialize a secret code by update corresponding variable (see UML diagram).

* Initialize the game board and start playing.

 

 

  • If player choose option [B] by input “b” or “B”, “Rules.txt” will be load and displayed on screen.

 

  • If player choose option [C] by input “c” or “C”, a list that records historical highest score will be displayed on screen.

 

  • If player choose option [D] by input “d” or “D”, the game will shut down.

 

The example of game flow

In this game, the players will guess a secret code randomly initialized by system in limited turns. Playing example of each turn could be like below:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

?                   ?                   ?                    ?                        Secret Code

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1                  2                  3                     4                       o?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

The Code Elements: 0 1 2 3 4 5

Your next guessing:

 

Quit the game(Q)

 

Every turn player will input a set of number with the same format as secret code the check if it matched or input “Q” or “q” to quit the game.

 

Processing Player Input

 

There will be several conditions in-game to ask player for an input:

  • Asking for a string input – used when asking player for their name.
  • Asking for a number input – used when player decide which option to choose in menu.
  • Asking for a string or number input – used when player decoding or quit the game.

 

After player’s input, according to different input, correspond process will be proceeding:

  • The player’s name will be sent to the Player class when creating a new player
  • The number will be sent to displayMenu () function to decide whether to be displayed.
  • The letter will be used to fill in slots in game.

 

There will be validation check when player inputting:

  • If player inputs a number out of range or invalid, system will ask for player to re-input.

 

The End Game Conditions

 

For end game conditions, essentially the game will end whatever player win or lose the game, a function called gameOver() will check the game matches the end conditions or not.

 

  • If player wins , gameOver() will stop the game and return congratulation message and ask for return to main menu or play again.
  • If player cannot match the correct code in limited tries, gameOver() will stop the game and ask for return to main menu or play again.

 

Additional Features Included

 

If possible I would like to add an highest score summary feature as mentioned before

 

  • every time player finished a game his/her score will be sent to an array called highestScores[] which can stores up to five recent records of score, when a new record added into it will be compared with other records.
  • If current record is greater than the greatest one, it will be input into first index.
  • Player can check the highest scores list in menu by choosing option.

 

UML CLASS Diagrams

 

 

 

 

 

 


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论