1 .TH mm 6 "Mark Wooding"
3 mm \- simple Mastermind game
7 .RI [ holes " " colours ]
12 program plays the game of Mastermind.
15 there are a collection of coloured code pegs,
17 The board has a number of rows of holes.
18 There are two players.
20 \(en the code setter \(en
23 \en a sequence of coloured pegs \(en and
24 enters it at their end of the board,
25 concealed by a small screen from the other player.
27 \(en the code guesser \(en
28 attempts to guess the code.
31 the guesser makes a guess
32 by filling in a row of holes with coloured pegs.
36 They award a black scoring peg
37 for each peg in the guess which matches
38 the corresponding peg in the code,
39 i.e., the right colour in the right place.
40 They award a white scoring peg
41 for each guess peg which matches a code peg in colour
43 i.e., the right colour in the wrong place.
44 Each guess peg can be scored at most once.
45 Only the number of black or white scoring pegs matters;
46 the order in which they're placed on the board is irrelevant.
48 The game ends either if the guesser guesses the code correctly,
49 or if they run out of guessing rows on the board.
51 Since this is a computer game,
52 there is no physical board on which to run out of space.
53 The game can therefore continue until either
54 the guesser successfully guesses the code,
57 Since this is a very simple program,
58 intended mostly to be a substrate for the computer player,
59 it doesn't have coloured pegs.
60 Instead, it uses numbers,
61 between zero and some upper limit specified on the command line
63 The default number of `colours' is 6,
64 and so the numbers should be between 0 and 5 inclusive.
66 When a human is expected to
69 they should type in a sequence of numbers
70 representing the desired colours, separated by whitespace,
71 and followed by a newline.
73 When a human is expected to
76 they should type the number of black scoring pegs awarded
77 (correct colour, correct place)
78 and by the number of white scoring pegs awarded
79 (correct colour, but wrong place),
80 separated by whitespace and followed by a newline.
81 .SS "Command-line options"
82 The following command-line options are recognized.
86 A human chooses the code,
87 and the computer attempts to guess.
88 This is the default mode.
89 If a code is provided on the command line,
90 then the computer will automatically rate its own guesses against it
91 (but promises not to cheat);
92 otherwise the human user is expected to rate the guesses.
96 The computer chooses the code
97 unless one was provided on the command line
101 and the human tries to guess it.
105 This mode can be used to cheat at some other Mastermind-ish game.
106 Initially, the user is expected to enter
107 their guesses in that other game,
108 and the ratings which their guesses received.
109 After the user has finished entering their guesses,
112 followed by a newline in place of the guess,
113 and the computer will start offering its own sensible guesses.
114 The human should relay these to the other game,
115 and enter the rating.
119 This mode simply runs the computer guesser
120 against every possible input code
121 and (eventually) reports some statistics about how well it did.
122 This is used to compare computer-guesser algorithms.
123 .SS "Command-line arguments"
124 Following the options, if any,
125 game parameters may be specified,
132 is the number of pegs in a code, and defaults to 4;
135 is the number of differently coloured pegs, and defaults to 6.
137 Following the parameters, a code may be given,
138 as a sequence of small integers.
139 This is ignored in tournament and solver modes;
140 in the computer and human guesser modes,
141 it gets the computer to rate guesses against the provided code,
142 rather than asking the human to rate (which is surprisingly error-prone)
143 or getting the computer to rate against a secret, random code.
145 The user interface is terrible.
148 (in Simon Tatham's portable puzzle collection).
151 <mdw@distorted.org.uk>