ekaratarakis / C-App-Alternative-version-of-Mastermind-game

C Application : An alternative varsion of the mastermind famous game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C-App-Alternative-version-of-Mastermind-game

This is a C application that implements an alternative version of the game Mastermind. In this version the player plays against the computer trying to guess correctly all the n digits of a decimal secret number. The exact number of digits must be entered by the player at the beginning of the game and it must lie in [3,5]. Also in the beginning of the game, the player must decide wheather dublicates are allowed or not. The player can enter numbers of n digits sequentially trying to guess the secret number (he can also quit by entering a negative number). The program must calculate the number of digits that the player guessed correctly and how many of them lie in the right position and print an appropriate message. As soon as the player has guessed correctly all the digits of the number the program must print an appropriate message together with the number of tryals the player used ultil the correct guess. More specifically, the functionality of this C application is described as follows.

  1. The program welcomes the player and invites him to enter the value of n. If the user enters a number n<3 or n>5 then he will be asked to reenter a new value n.
  2. After that, the player will be asked if he prefers to allow dublicates in the secret number or not.
  3. The program creates a random non negative number of n digits according to the player's choices in the steps above and askes the player if he wants the program to print that secret number.
  4. Now the playes has the 1st guess by entering an n-digit number. At this point, the program checks if that number is really an n-digit number. If the player prefers to not allow dublicates in the secret number the program ckecks if the player's guess satisfies than condition. If the conditions above are not satisfied the player must reenter an new guess-number.
  5. Subsequently, the program must calculate and print 2 numbers
    • The number of digits the player has correctly guessed.
    • The positions of the number of digits the player has correctly guessed.
  6. The stepd 4 and 5 are repeated until the player finds the correct secret number or until the player quits.
  7. As soon as the player guesses correctly the sectet number, the program must confirm that this is the secret number and print the number of the efforts the player used in order to correctily guess the secret number. If the player quits the program must print the secret number together with the number of efforts.

About

C Application : An alternative varsion of the mastermind famous game


Languages

Language:C 100.0%