The game code itself:
@g=map{$_=sprintf"%04o",$_;$_=~y@0-7@A-H@;$_}0..4095;for($|=1;@g>1;){ +print$f=$g [@g*rand],$";($S=<>)=~/^[0-4]{2}$/?(@g=grep{$d=4-($a=($f^($e=$_))=~y@\ +0@@);$d-= ($c=index$e,$_)<0||(substr($e,$c,1)="")for(split'',$f);$&eq$a.$d}@g):p +rint"\7"}
How to play it:
  1. Think of a string [A-H]{4}
  2. Start: perl game.pl
  3. The computer prints a guess [A-H]{4}
  4. You evaluate its guess by two digits (and <Enter>). The first digit is the number of common letters in good positions, and the 2nd digit is the number of common letters in wrong position. For example, the guess FFGA has value 21 if the string is DFGF.
  5. If the value wasn't 40, go back to step 3.
Enjoy! (But the computer always wins.)

In reply to a 240-byte game for you by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.