/number-guess-game

This project is a number prediction game that I made for my lesson and use the C language.

Primary LanguageCMIT LicenseMIT


💯 Number Guess Game


This project is a number prediction game that I made for my lesson and use the C language. live-demo

Screenshot

Screenshot 1

Game Rules

  • Suppose the user enters four as the number of digits.
  • And the four digit random number generated by the program is "8203". The user will try to guess the number. The The following figures are examples of guesses.
  • If the guess is correct a “congratulations” message will be printed. All 4 digits are correct and in their correct location so the result will be “+4”. Record the number of guesses. And print the the prediction number as "Total number of attempts=...".
  • If the number guessed is "2830", each of the four numbers in in "8203", but none of them is in the right place. in the right place. So 4 numbers are guessed and each is in the wrong place. in the wrong place. The result is +0-4.
  • If the guess is "8572", there are 8 and 2 in "8203". The "2" is in the wrong place and the "8" is in the the right place. So two of the numbers are guessed one of which is in the right place and one of which is not. The result is +1-1.
  • If the guess is "8291", there are 8 and 2 in "8203". Both are in the right place. So two of the So two of the numbers are in the right place. The result is +2-0.
  • If the guess is "9765", none of the numbers are in "8203". in "8203". So the result must be +0-0.
  • The number of digits is taken from the user and you can play the game for 4 digits, 5 digits,...9 digits. numbers.

Lessons learned

I learnt to make a simple game using the C language. I noticed all the details of the modu acquisition functionality and started to explore data structures by developing myself in terms of using arrays with this project.

Feedback

If you have any feedback, please contact me at: emrahfdn.work@gmail.com