[comp.unix.xenix.sco] A cure for boredom

glen@sungate.UUCP (Glen) (01/13/91)

With all the things that are going on, both in this group
and the world, I thought a little mindlessness might be
in order.  No flames, please - I kept it short.  Supported
for SCO versions only.

I'm sure everyone here knows how to write this, but who would?
So I did.  Enjoy, and may we all find peace...


:
#       guess.src 1.0 91/01/12
#
#       Public domain guess-the-number game.
#
#       I was bored.
#
echo "\nWelcome to guess the number!  Yet another exciting,"
echo "time-killing program.\n";ans=`random 100`
echo "I'm thinking of a number between one and one hundred.\n";gg=0
while true
do
echo "What is your guess?  \c";read aaa junk;gg=`expr $gg + 1`
[ -z "$aaa" -o "$aaa" = "q" ] && echo "The number was $ans." && exit
[ $aaa -eq $ans ] && echo "Congratulations! You got it in $gg tries!" && exit
[ $aaa -lt $ans ] && echo "My number is higher than that.\n"
[ $aaa -gt $ans ] && echo "My number is lower than that.\n"
done
-- 
--*--  --*--  --*--  --*--  --*--  --*--  --*--  --*--  --*--  --*--  --*--
Glen / sungate! 619-453-6644         It'll take time, but we're going far...
BangPath: uunet!sungate!glen         you and me, I know we are... In time,
InterNet: glen%sungate@uunet.UU.NET  we'll be dancing in the streets all night