From: Martin DeMello Date: 2008-07-30T06:23:32+09:00 Subject: Re: deaf grandma. On Tue, Jul 29, 2008 at 2:06 PM, houston barnett-gearhart wrote: > (http://pastie.org/243587). > > I'd say it's about 99% complete. Although I do need the following, as > mentioned above: > > • uniform indentation; This is something a good editor should do for you. If you let us know what platform you are on, people can recommend their favourite editors and IDEs :) I use gvim myself; below is an example of how it autoindents your code: http://pastie.org/243603 A heavyweight but very nicely polished option is netbeans with ruby support: http://wiki.netbeans.org/Ruby > • shortened print statements; Not sure what you mean by that. If you have a lot of text to print, it needs to be included, after all :) There are things you could do to compact the code but they add little value at this stage - I'd say go ahead and do it the straightforward way as you have here. > • one less loop There's a problem with your code as written - note that once you've said "bye" you can never say anything else - it sticks in the loop till it counts three 'byes' in a row. Whereas what you want is to exit the whole loop if you see three byes in a row, otherwise just carry on as normal. What you *should* do is this - if the user has yelled, so that granny hears what he says, do an additional check for his having said "bye". ---- If that is true, then increase the bye count. -------- If the bye count is 3, exit the loop ---- If that is false, reset the bye count to zero and carry on with the rest of the code Hope that helps! martin