Prog 2: MiniMasterMind

Due at 12 Noon on the date shown in the course schedule

Write a program similar to Mastermind, except you will use 3 digits instead of colors.  Running the program should look like the following:

Author:  Dale Reed          

Lab:     Wed 5am            

Program: #2, MiniMasterMind 

 

Welcome to MiniMastermind. 

The program selects 3 distinct random digits 0..9.  

On each turn you guess 3 digits.  Program indicates how many are correct.

You have 10 moves to guess the number.  Good luck! 

                            In place  Out of place

                            --------  ------------

1. Your guess: 012

           You entered: 012     0          1     

2. Your guess: 021

           You entered: 021     1          0     

3. Your guess: 345

           You entered: 345     1          0     

4. Your guess: 354

           You entered: 354     1          0     

5. Your guess: 321

           You entered: 321     2          0     

6. Your guess: 678

           You entered: 678     0          1     

7. Your guess: 687

           You entered: 687     1          0     

8. Your guess: 327

           You entered: 327     1          0     

9. Your guess: 381

           You entered: 381     3          0     

*** Congratulations!  You did it! ***

Thank you for playing.  Exiting...

Alternatively if you are not able to find the answer within ten moves, a message and the answer is displayed, as follows:

Author:  Dale Reed          

Lab:     Wed 5am            

Program: #2, MiniMasterMind 

 

Welcome to MiniMastermind. 

The program selects 3 distinct random digits 0..9.  

On each turn you guess 3 digits.  Program indicates how many are correct.

You have 10 moves to guess the number.  Good luck! 

                            In place  Out of place

                            --------  ------------

1. Your guess: 012

           You entered: 012     0          1     

2. Your guess: 021

           You entered: 021     1          0     

3. Your guess: 120

           You entered: 120     0          1     

4. Your guess: 345

           You entered: 345     1          0     

5. Your guess: 354

           You entered: 354     1          0     

6. Your guess: 367

           You entered: 367     1          0     

7. Your guess: 389

           You entered: 389     2          0     

8. Your guess: 398

           You entered: 398     1          1     

9. Your guess: 391

           You entered: 391     2          0     

10. Your guess: 319

           You entered: 319     1          1     

Better luck next time.  Answer was 381. 

Thank you for playing.  Exiting...

Notes

Stages

Write your program in stages as follows, where the number of points for each stage (out of the 65 total possible points for "Runs correctly" combined with "Functional Decomposition") is shown:






15 points Extra Credit (very hard!):  Write a program to flip the game around, where you as the human come up with 3 digits, and the computer has to guess them from you, where on each move you indicate to the computer how many digits are in place and how many are out of place.  Please don't bother turning in the extra credit unless the computer correctly guesses the numbers most of the time.