Student Activity

Mastermind Has Entropy

General Description: This activity explores the concept of Entropy and missing information. You will play the game Mastermind to learn a state space and then analyze it with Entropy. You will collect data from the games you play, make a chart showing the game state and Entropy, and answer questions to build understanding.

Why am I doing this? This lab is designed to give you experience with an important concept in machine learning, information gain. In class we have talked about the need to measure information in bits to enable programatic optimization. This lab gives you a chance to put that theory into practice.

What am I going to do? First you will play the game Mastermind with your partner and learn the rules. As you are playing you will also build a dataset. You will then proceed to analyze the dataset and answer a series of questions.

Important Note!

We will play with one modification to the rules. The feedback pegs will correspond to specific guess pegs. E.G. if the guess peg in the second position earns a white feedback peg then feedback giver will say "the white peg corresponds to the peg in position two"

Collect Data

Play a few games, make sure each player get to be the guesser. While you are playing record data in the following way. Make a table with 5 columns labeled "Round, Guess, Feedback, Possible Codes Remaining (N), Entropy H=Log2(N)"

Questions

  1. Describe the state space for the codes. How many codes are possible?

  2. Describe the state space for the feedback. How many feedbacks are possible?

  3. Calculate the entropy for the full state space of codes at the start. How many bits of missing information are there?

  4. Make a chart showing log2(x) from 1 to the maximum number of codes.

  5. Explore value of a black feedback peg:
        a. Compute the number of codes if you have zero, one, two, three, or four black feedback pegs.
        b. Compute the entropy if you have zero, one, two, three, or four black feedback pegs.
        c. Compute the information gain for gaining a black peg.

  6. Explore value of a white feedback peg:
        a. Compute the number of codes if you have zero or one white feedback pegs.
        b. Compute the entropy if you have zero or one white feedback pegs.
        c. Compute the information gain for gaining your first white peg.

  7. Which was it easier for you to calculate the black peg value or the white peg value? Why?

  8. Assuming it was the first turn of the game: Would you rather your feedback be a black peg or two white pegs?

How will I know I have succeeded?

Specs Category Specs Details
Formatting - 2 pages max (not counting data)
- PDF format
- Headings
  - Lab Name
  - Your name, course, date
  -Questions
Responses to Questions - Goal: Explore Entropy through the guided questions
- Detailed responses to the questions that include rationale where appropriate
- Data table from your games
- Format your responses in a numerical list corresponding to the questions list

Acknowledgements: Special thanks to Jess Taggart from UVA CTE for coaching us. This structure of this rubric is based on Streifer & Palmer (2020).