Mastermind


master.ss

The teachpack master.ss provides the single operation master, which implements a simple GUI selecting two colors, evaluating the two guesses, and displaying an answer. The operation consumes the function check-guess and then plays TeachMasterMind. The function check-guess is responsible for comparing the color guesses of a player with the (random) choices of master.

The teachpack provides only one operation:

  • master : check-guess -> symbol;
    It prompts users for two colors (symbols) and uses check-guess to play mastermind.
    If the guesses completely match the set-up, check-guess must return 'PerfectGuess; otherwise it must return a different, informative symbol.
  • Legitimate colors are: black white blue red green gold pink brown purple navy