On Monday, December 27, 2004, at 2:59:09 AM, Roberto Lupi wrote:
> there is one thing that I don't like in yours and Ron's code: all
> those reference to frameStart, frameStart + 1, frameStart + 2.
> We are dealing with a stream of rolls, then why don't we make our data
> structure a stream of rolls?
Well, one reason is that the bonus rolls belong to two frames. I
suspect rather strongly that the code shown won't pass the tests.
For example, a strike frame consumes just one roll, the first ten
points, but its score is the sum of three rolls counting that one.
Meanwhile the first roll after the ten-point initial one actually
belongs to the next frame:
If the rolls are, for example,
10, 6, 4, 5, 4, then the frames are
[10], [6, 4], [5, 4] and the frames /score/
[10+6+4], [6+4+5], [5+4], or
20, 15, 9
In view of that, Alistair worked offline with an algorithm that
expanded the stream so you could just sum it up, something like
10, 6, 4, 5, 4 turning into
10, 6, 4, 6, 4, 5, 5, 4, ...
Ron Jeffries
www.XProgramming.com
Hope is not a strategy. -- Michael Henos
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/