• Game rules: At the beginning of the game, a number of 4 distinct digits is generated. A player is asked to guess the number. Each time the player guesses the number, the game gives a hint with “XAYB”, where X is the number of digits in the correct positions and Y is the number of correct digits but not in the right positions. For example,
• Requirements:
- Generate a number of 4 distinct digits named by “num”.
- Create a function(“hint”) that the guessing number is an input and outputs a hint.
Aucun commentaire:
Enregistrer un commentaire