You'll need to provide a nine-level word guessing game in the fewest characters possible (in your language of choice).
- Provide a word-list
(one word per line, seperated by a
/usr/share/dict/wordsor similar could do). It's fine to pipe a filename or the wordlist itself into your solution.
- Provide 9 levels with incrementing word length (words with 4 characters
Level 1: a random word from the wordlist containing 4 characters Level 2: a random word from the wordlist containing 5 characters ... ... Level 8: a random word from the wordlist containing 11 characters Level 9: a random word from the wordlist containing 12 characters
- In every level, obfuscate a randomly chosen word from the list (with a specific word length of course) and replace a certain number of characters by the asterisk (
*). The number of characters to replace:
current_word_length / 3(round down). Randomize which characters to replace.
- Let the player 'guess' the word (only one
tryper level), give feedback (
wrong) and give points accordingly. When correct, the player gains
number_of_obfuscated_characters * 10 points.
- Print the current score at the end of each level.
The format (& sample I/O):
Make sure you follow the following formatting scheme:
Level 1 # level header ======= # g*ek # obfuscated word geek # user input correct # guess validation score: 10 # print score # Level 2 ======= l*nux linux correct score: 20 Level 3 ======= ran**m random correct score: 40 ... Level 9 ======= sem***act*ve semiinactive wrong score: 90
Shortest solution (by code character count). Have fun golfing!