Google Groups Home Help | Sign in
Message from discussion Bowling Game once more
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
ig...@yahoo.com  
View profile
 More options Jan 3 2005, 2:36 am
Newsgroups: comp.object
From: ig...@yahoo.com
Date: 2 Jan 2005 23:36:49 -0800
Local: Mon, Jan 3 2005 2:36 am
Subject: Re: Bowling Game once more
>  frameFirstBall + frameSecondBall + nextFrameFirstBall

aka roll0 + roll1 + roll2

> And even those I'd not recommend reordering

I mentioned it because it's the sort of thing someone might mindlessly
reorder, knowing that addition is commutive. (They might reorder the
statement sequence, but they'd be acting against the ordinary
expectation that statement sequence matters.)

> I know what peek and next mean

We have that in common. Of course, what we write may be read by others
less-adept.

The thing that I was curious about is that the obvious concern you have
for expressing the domain detail (frameFirstBall etc) seemed to
lose-out against the side-effects of the "peek" metaphor.

> preferred solution

The usual solution for the trivial version of the bowling game, in a
language which support pattern-matching on lists:

Start = score [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,5,3] 0 0

score rolls total 10 = total
score [x,y] total frame = total+x+y
score [x,y,z:rest] total frame
| x == 10    = score [y,z:rest] (total+x+y+z) frameCount
| x+y == 10  = score [z:rest]   (total+x+y+z) frameCount
| otherwise  = score [z:rest]   (total+x+y)   frameCount
where frameCount = frame+1

http://groups-beta.google.com/group/comp.object/msg/45ed159928b69648

> write an article

Better to get Paul Sinnett to write about his refactoring
http://groups-beta.google.com/group/comp.object/msg/0212c8de1848cd11

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google