The player attempts to guess a random 4-digit code in as few turns as possible. After each guess, the computer indicates which numerals are correct and which numerals are correct and in the correct position.
Mastermind was first published as type-in source code in Creative Computing Vol. 2, No. 2, March/April 1976.
Mastermind II (the same game with different implementation) was written by Steve North and published as type-in source code in Creative Computing Vol. 3, No. 6, November/December 1977.
Both listings were in vanilla BASIC, intended to work on any system (with possible minor adaptations required).