Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Test Driven Development Sample
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
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
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. Listen and type the numbers you hear
 
Isaac Gouy  
View profile  
 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


 
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.