Solve Hangman With Linux
By using Linux and standard commands (cat and grep) that come with it we can easily solve hangman puzzle. Lets see with an example. Let us suppose the word is PLANET and so far we have guessed _ _ ANE_ Lets assume that we have made incorrect guesses with letters b,s,a,i,u. Now lets try to solve the hangman with the help of our Linux box. We all know that there is a file called words that ships with all most all Linux distribution. The file contains dictionary word. Many people have used the file for many clever uses. Let us also try to use that file to solve our hangman. In my box the file is in "/etc/dictionaries-common/words" If you do: cat /etc/dictionaries-common/words it will show you all the words. Lets try to grep our answer with regular expression. cat /etc/dictionaries-common/words | grep -iE ^..ane.$ here, -i makes the grep case insensitive. - E is for extended regular expression. ^ means starting of the word $ means end of the word . means a letter...