Last modified: 2021-05-21
This is a course web page of
David Casperson
Associate Professor
Computer Science
University of Northern British Columbia

CPSC 370: Functional and Logic Programming (2011)

Notes about Mastermind-like games

There is a reasonable Wikepedia article about Mastermind here. The game is currently sold by Pressman Toys who give scoring instructions here.

The classic game is played with code pegs of six different colours, and four holes for 1296 different possible codes, but clearly other parameters are possible. Note that, unlike “Bulls and Cows”, Mastermind allows repetitions of coloured pegs, both in the guesses and in the answers.

For the purposes of programming assignments, assume the six-colour, four-hole version of the game unless otherwise instructed.

For greater precision as to what the scoring algorithm is, note that the number of black (or red in Pressman’s version) pegs scored is the number of exactly matching pegs; and that the number of black plus white pegs scored equals the cardinality of the intersection of the multisets.

Home page Semesters Site Map
go back Fall 2011 go forward
2024-12 other links

CPSC 100 [Other years]
CPSC 370 [Other years]
Books
Homework
Dates
Policies
Prolog resources
Blackboard Link
Java
David’s Schedule

fall-2024