mercredi 26 mai 2021

Number Guessing Game for 0A0B in R

• 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,

enter image description here

• Requirements:

  1. Generate a number of 4 distinct digits named by “num”.
  2. Create a function(“hint”) that the guessing number is an input and outputs a hint.



Aucun commentaire:

Enregistrer un commentaire