Programming Comparisons: Mastermind


Problem: give the smallest possible complete program that, when run, plays a game of Mastermind in the following way: it accepts any number of guesses on standard input in the form of 4 digits followed by a newline. The digits must be between 1 and 6. If your guess is incorrect, it will print 0 or more *s, signifying the number of digits that are correct and in the proper position, followed immediately by 0 or more +s, indicating the number of digits which are correct but in the wrong position, followed by a newline. If all digits are correct, the program prints "Tries: n\n" where n is the number of tries, then exits. All output is done to standard output.

perl: 164
ruby: 243
haskell: 269