Mastermind Challenge

mastermind
Have you ever played the board game “Mastermind”?

If you are not too sure about the rules of this game, you should first check this page.

For this challenge we are going to create this game of mastermind where the end-user plays against the computer. The end-user’s role is to guess the choices of 4 colours made by the computer.

Learning Objectives


By completing this game we are using all our coding skills using nested loops and IF statements.

We are also learning about how flowcharts can be used to describe a complex algorithm.

Flowchart


Can you create the flowchart for this computer game yourself?
Give it a try. Once done, compare your flowchart with our flowchart:
Mastermind-Thumbnail
Note that there is often more than one approach to solve a problem.

Code


Use either your flowchart or the one given above and translate it into programming code using Python.

Share Button
Posted in Computer Science, Python - Advanced, Python Challenges Tagged with: , , ,

Our Latest Book