Xref: utzoo comp.unix.xenix.sco:1344 alt.kids-talk:338 Path: utzoo!utgpu!cs.utexas.edu!uunet!sungate!glen From: glen@sungate.UUCP (Glen) Newsgroups: comp.unix.xenix.sco,alt.kids-talk Subject: A cure for boredom Keywords: game guess number Message-ID: <190@sungate.UUCP> Date: 12 Jan 91 23:09:57 GMT Followup-To: alt.dev.null Organization: sungate! Where magic still lives... Lines: 32 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