Skip to content

A low-level implementation of the classic game “Mastermind”. I write a program that generates a four-digit random code and the user needs to guess the code in 10 tries or less. If any digit out of the guessed four-digit code is wrong, the computer should print out “B”. If the digit is correct but at the wrong place, the computer should print “Y”…

Notifications You must be signed in to change notification settings

vkn84527/Guessing-Number-through-4-digit-pin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Guessing-Number-through-4-digit-pin

A low-level implementation of the classic game “Mastermind”. I write a program that generates a four-digit random code and the user needs to guess the code in 10 tries or less. If any digit out of the guessed four-digit code is wrong, the computer should print out “B”. If the digit is correct but at the wrong place, the computer should print “Y”. If both the digit and position is correct, the computer should print “R”.

Program Preview :

First, I write a function to generate a random four digit code using Python’s random module. Next, we define a function that asks for user input. Finally, we write a function that compares the generated code to the guessed code and gives appropriate results.

About

A low-level implementation of the classic game “Mastermind”. I write a program that generates a four-digit random code and the user needs to guess the code in 10 tries or less. If any digit out of the guessed four-digit code is wrong, the computer should print out “B”. If the digit is correct but at the wrong place, the computer should print “Y”…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages