Article 13271 of alt.sources:
Path: nntpd.lkg.dec.com!pa.dec.com!decwrl!hookup!news.mathworks.com!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!news.u-net.com!news
From: a.hunger@hulmecc.nwnet.co.uk
Newsgroups: alt.sources
Subject: mmd - MANUAL PAGE 2/4
Date: Wed, 20 Mar 1996 21:06:15 GMT
Organization: Hulme Community Computing Ltd.
Lines: 194
Message-ID: <4ipsch$rpp@nuntius.u-net.net>
Reply-To: a.hunger@hulmecc.nwnet.co.uk
NNTP-Posting-Host: hulmecc.u-net.com
X-Newsreader: Forte Free Agent 1.0.82

MMD(6)              UNIX Programmer's Manual                  MMD(6)


NAME
      mmd - play mastermind

USAGE
      [-depth <num>] [-gametree] [-human] [-noright]
      [-noscramble] [-pattern <pattern>] [-pipe]
      [-radix <num>] [-seed <num>] [-size <num>]
      [-test] [-verbose]

DESCRIPTION

      mmd allows the invoker to play the game of
      mastermind (similar to bulls & cows (see moo(6)))
      with the computer.  The thing that makes the game
      interesting is that the computer can guess a
      pattern that you choose.  It uses an optimal
      information-theoretic algorithm and so plays
      extraordinarily well - better than any human
      being.  This takes a lot of computation, so
      patterns chosen are stored in a data file so a
      computation never needs to be made twice.  The
      patterns chosen are put through a randomizing
      algorithm that makes the game more interesting to
      play, without losing optimality.

RULES OF THE GAME

      A "pattern" is an ordered n-tuple of integers (or
      colours in the original game sold by Invicta) in
      the range 0 to r - 1.  To start the game, player 1
      chooses a pattern, keeping it hidden from player
      2.  Player 2 then has to try to guess the pattern.
      At every guess, player 1 rewards player 2 with a
      "score" - a pair of non-negative integers, "right"
      and "wrong". right is a count of how many numbers
      in both n-tuples were in the same position and had
      the same value. wrong is a count of how many of
      the remaining numbers were the same but in
      different places.  This scoring system is
      symmmetric - i.e. it doesn't matter which is the
      guess and which is correct - you get the same
      score.  For example, for n = 4 and r = 6 (the
      default with the Invicta game), the score between
      1551 and 1115 is right = 1, wrong = 2, as is the
      score between 5023 and 5330. The guessing process
      continues until player 2 knows what pattern player
      1 has chosen, e.g. by getting a score right = n,
      wrong = 0.

OPTIONS 

      -depth <number>

      specify game tree lookahead to depth <number>.
      The default depth is 0.  Higher depths produce a
      better game tree but take much more computation.
      However remember that no computation needs to be
      done twice, since the game tree is stored in a
      data file (see FILES) as it is created.

Printed 2/22/96                 2/22/96                             1
MMD(6)              UNIX Programmer's Manual                  MMD(6)

      -gametree

      generate entire game tree. The program effectively
      cycles through all possible patterns and finally
      gives the pattern that took the most number of
      guesses to that depth.  mmd -gametree run from
      scratch takes about 13 minutes on a 33 MHz 486-SX. 
      However it only has to be done once - after that,
      the program response is instantaneous.

      -human

      have the computer choose the pattern while the human
      guesses it.  The default is the reverse.  This switch is
      incompatible with -test, -pattern <pattern> and -gametree.

      -noright

      in this mode the rules of mastermind are modified
      - one is only told how many are the right number
      but in the wrong place.

      -noscramble

      this option disables the scrambling of the guesses
      of mmd and allows one to inspect the computed game
      tree directly.

      -pattern <pattern>

      test the program out - the computer guesses the
      pattern following -pattern, e.g. -pattern 0012.
      This switch is incompatible with -human and -pipe.

      -pipe   

      pseudo-terminal or pipe mode. This mode is
      intended to be used in conjunction with, say, an
      X-Windows or Sunview wrapper.  Guesses are
      immediately preceded by '?' and terminated by
      '\n'. Scores are expected to be a pair of unsigned
      integers, right first, then wrong, separated by
      white space and terminated by '\n'.  In -noright
      mode the score is a single integer terminated by
      '\n'.  If mmd thinks it knows the pattern, it
      outputs a '!' immediately followed by the pattern,
      followed by a '\n' and terminates.  If mmd detects
      an error in the scores given, it outputs a '%'
      immediately followed by a '\n' and terminates. In
      -human -pipe mode mmd accepts data in the form
      produced by mmd in -pipe mode, so mmd can play
      itself!  Anything sent to stderr is a one-line
      error message, terminated by '\n', preceding
      termination.







Printed 2/22/96                 2/22/96                             2
MMD(6)              UNIX Programmer's Manual                  MMD(6)

      -radix <number>

      set the range of numbers to 0 - (<number> - 1).
      The default is -radix 6.  -radix 0 is not
      permitted.

      -seed <number>

      set the seed of the random number generator to
      <number>.  This is used to make the behaviour of
      the program repeatable.

      -size <number>

      set the size of the n-tuple to <number>.  The
      default is -size 4.  -size 0 is not permitted.

      -test

      similar to -pattern <pattern> except a pattern is
      randomly chosen.  This switch is incompatible with
      -human and -pipe.

      -verbose

      if this switch is selected debug information is
      printed out during a program run.

ENVIRONMENT

      Environment variable MMDPATH contains the path for
      the data file, e.g. "/usr/games/mmddata/" - you
      must have the trailing "/".  If MMDPATH is unset,
      the default is the current directory.

FILES

      mmd uses/generates a data file in the $MMDPATH
      directory recording the game tree.  Different
      files are produced for distinct game trees. The
      file format is portable between different UNIXes
      and between MS-DOS and UNIX.

BUGS

      No file locking is performed, so if multiple mmd
      processes are modifying the same file, they can
      get in a real mess.  However, once a file has been
      generated with the -gametree option, the file is
      never written to again and its permissions can be
      changed to read only.










Printed 2/22/96                 2/22/96                             3




