Thanks so much for any assistance~!!!!
#!/usr/bin/csh
@ n = `date +%S * date +%S * date +%M`
set wrd = `tail -$n /usr/dict/words | head -1
## I was using this to generate a random word, but I think that I need a better system, any ideas?`
echo "Let's play hangman"
@ x = 10
@ lettercount = `echo $wrd | wc -m`
while ($x >= 1)
echo "Type WORD if you want to guess a word, and LETTER if you want to guess a letter."
set LorW = $<
echo $LorW | grep '^WORD$' > /dev/null
set wantword = $status
echo $LorW | grep '^LETTER$' > /dev/null
set wantletter = $status
if ($wantword == 0) then
echo -n "The word has $lettercount letters in it. Well, what do you think it is?"
set guessedword = $<
set y = $wrd
set yy = $guessedword
if ($x == $y) then
echo "YOU WIN\!"
else
@ x = $x - 1
echo "Sorry, try again. You have $x guesses left"
endif
else if ($wantletter == 0) then
echo -n "The word has $lettercount letters in it. What letter do you think is in it? "
set guessedletter = $<
echo $wrd | grep $guessedletter > /dev/null
set yes = $status
if ($yes == 0) then
echo "Yes, $guessedletter is in the word"
else
@ x = $x - 1
echo "Sorry, try again. You have $x guesses left"
endif
else
echo "You tried to pick something other than LETTER or WORD"
endif
end
echo "The word was $wrd Better luck next time."