--- In [EMAIL PROTECTED], Ron Jeffries 
<[EMAIL PROTECTED]> wrote:
> On Monday, December 27, 2004, at 8:00:14 AM, Roberto Lupi wrote:
> > I can write a stream-based implementation using #peek ...
> > I would have to add my own and I don't think that
> > it's worth the effort.
> 
> Yes. You need to peek two into the future, and I haven't seen such a
> method either. It would be rather a nifty implementation, though:

Hi, Roberto,

I tried for the Stream implementation for exactly those reasons, and 
gave up for exactly those reasons. I found 'peek' but couldn't find 
a 'peekAt:' thing.

Ron suggested using a Stack at one point, so one could go Pop, Peek, 
Push .... but at this point I felt we had left the bowling domain by 
too far.  

I'll be happy to see if anyone can get rid of th +1 and +2. It weirds 
me out, too.

(p.s. I haven't tried a version where the frames only take the rolls 
they need and ask each other for the bonus rolls.  I haven't tried 
it, but it /feels/ like it'll get too complicated. ... possibly that 
means I need to try and find out ...)


> 
>   self isStrike
>     ifTrue: [^stream first + stream peekFirst + stream peekSecond]
> 
> with isStrike:
> 
>   isStrike
>     ^stream peekFirst = 10
> 
> I think I like it! I'm gonna try that approach. Cool idea.
> 

and presumably also (?)
   isSpare
     ^stream peekFirst < 10 and:
          [ stream peekFirst + stream peekSecond = 10 ]
 
Tell us how you feel about that one ....
cheers,









To Post a message, send it to:   [EMAIL PROTECTED]

To Unsubscribe, send a blank message to: [EMAIL PROTECTED]

ad-free courtesy of objectmentor.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/extremeprogramming/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to