June Kim wrote: > Those who don't know much about bowling, please refer to > http://en.wikipedia.org/wiki/Bowling#Basic_Rules
Ok, that would include me. > spare_case=:9 1 8 2 7 3 6 4 5 5 4 6 3 7 2 8 1 9 8 2 1 ... > assert 251 = score spare_case This seems wrong, given the wikipedia page's description Here's a breakdown of the scores on a per-frame basis: spare_scores=:".;._2]0 :0 9 1 8 8 2 7 7 3 6 6 4 5 5 5 4 4 6 3 3 7 2 2 8 1 1 9 8 8 2 1 ) +/,spare_scores 145 Also, since there's only ten frames, and since the highest possible score for a spare is 19, I don't think it's possible to get a score of 251 for a game where every frame is a spare. So here's my implementation: shift=:|.!.0"0 1 fr=: 10&= +. [: ~:/\ 10>] inframe=: 10 >: +/[EMAIL PROTECTED] frame=: fr *. inframe strikes=: [: +/ _1 _2 shift frame *. 10&= spares=: _2 shift frame *. 10&~: *. 10=]+1&shift scores=: * inframe+strikes+spares Here's my concept of the total scores for each of the cases you listed: assert 0=+/scores empty_case assert 90=+/scores open_case assert 145=+/scores spare_case assert 300=+/scores strike_case assert 200=+/scores alt_case > p.s. a variation is scoring as each roll arrives(think of the > electronic score board that's updated automatically just-in-time). To see intermediate scores, use a truncated argument. To see the full score progression for a game, you might use something like: +/@scores\ spare_case 9 10 26 28 42 45 57 61 71 76 84 90 96 103 107 115 117 126 142 144 145 -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
