Thank you for the solution but it doesn't seem to work right.

   none_and_spare_case=:0 10 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NB. 30
   assert 30 -: +/ scores none_and_spare_case
|assertion failure: assert
|       assert 30-:+/scores none_and_spare_case

The result returned is 50, which is obviously wrong.

Check these two links when the rules look vague:

  http://www.bowlingteam.it/score.html
  http://www.bowling2u.com/trivia/game/scoring.asp

On 3/26/06, Miller, Raul D <[EMAIL PROTECTED]> wrote:
> Here's a cleaner way of expressing the bowling scorer:
>
> shift=:|.!.0
> frame=: (*.10 >: +/\)@(10&= +. [: ~:/\ 10>])
> scores=: (2 shift ]) (] + [ * 10 <: ]) frame * ] + 1 shift ]
>
> As before, the total score is +/@scores pins (where pins is
> the number of pins knocked down by the ball).
>
> Note that the result of this "scores" verb is organized
> differently from that of the first one I posted.  The first
> one I posted rates the score for each ball.  This one rates
> the score for each frame (and scores non-frame balls as zero
> points).
>
> --
> Raul
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to