A player guesses letters that are part of a word!
If he has not guessed the complete word before making six (6) mistakes, he has lost!
_______
|/ |
| (_)
| \|/ It is a game over!
| |
| / \
|
___|___
⚫ Your Challenge
In a language of your choice, write a program that takes as its input (in some way) the target word (with blanks) and the letters that have been guessed already. It should then output the next letter to be guessed.
For example:
$ echo -n "p...s\npds" | ./guesser
e
You may assume the word to be guessed is an English word and contains only lowercaseASCIIletters.
Provide code and instructions if usage is not obvious. Consider using a tripcode to ease conversation about your entry.
Entries will be judged on GOODITUDE (defined as its win/loss ratio over twenty random games), on SPEED, and on CLEVERNESS.
Your deadline is 23:59:59 on Sunday, May 20th. Results will be posted the following day.
|∧_∧
|´・ω・) < Good luck!♫
||と ノ
Name:
Anonymous2012-05-19 21:55
Against random words the best strategy is to maximize your expected chance of winning, but because the game tree grows exponentially you can't brute force every possibility and have to use a heuristic. ``Most used character'' is a very good heuristic, and ``most entropy in result for this turn'' is also pretty good but harder to compute. How many of the top heuristic choices to examine is a trade-off, but because of diminishing returns I like 2. Perhaps a dynamic choice would be best.
On another note, don't forget to filter out words that have characters that have already been guessed and found not be in the word.
#lang racket/base
;; Usage: racket -t hangman.rkt [word misses]
;; Input is taken from stdin if not given on command line