The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Message from discussion Test Driven Development Sample

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Nov 24 2003, 4:50 pm
Newsgroups: comp.object
From: ig...@yahoo.com (Isaac Gouy)
Date: 24 Nov 2003 13:50:14 -0800
Local: Mon, Nov 24 2003 4:50 pm
Subject: Re: Test Driven Development Sample

Ron Jeffries <ronjeffr...@REMOVEacm.org> wrote in message <news:l11irvgd06vp6aqups002oobumiun3u3u7@4ax.com>...
> Adventures in C#: The Bowling Game
> Ron Jeffries
> 11/17/2003

>   When I demonstrate Test-Driven Development using the Bowling Game

Following on from BUFD version of the Bowling Game (given that we've
figured out the solution as far as #3) a language with pattern
matching and list functions would allow a recursive solution (compare
to #4) like this:

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 pins 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) (frame+1)
| x+y == 10  = score [z:rest] (total+x+y+z) (frame+1)
| otherwise  = score [z:rest] (total+x+y) (frame+1)

To explain:
- if we've done 10 frames we're finished
- if there are only 2 items we're finished (main clause needs 3 items
to match)
- 3 rules for calculating the score

best wishes, Isaac

To post a message you must first join this group.