You wrote: "a frame is always two times a throw" but the specification says "A frame is composed of one or two ball throws" and later we learn that the 10th frame may have three throws.
There is an issue with your Smalltalk. aCollection withIndexDo: [:index :item | "You have the arguments in the wrong order. It is :item then :index" ... index := index + 2 "this is not legal"]. The assignment is not legal because you are not allowed to assign to method parameters or block parameters. You're going to have something like this: game := BowlingGame new. ... game roll: nPins. score := game score. Since the score of a strike or a spare depends on the scores of the *next* two throws, it might be easier to process the throws backwards. On Sat, 13 Apr 2019 at 04:32, Roelof Wobben <r.wob...@home.nl> wrote: > > Hello, > > Im thinking how to solve this one : > https://github.com/exercism/problem-specifications/blob/master/exercises/bowling/description.md > > so I thought because you throw two times for a frame to solve it like > this : > > > aCollection withIndexDo: [:index :item | > (if spare) ifTrue: take 3 items out of the score collection and sum > them up > (if strike) ifTrue: take 4 items out of the score collection and sum > them up. > (if not a spare and not a strike) : ifTrue: take 2 items out of the > score collection and sum them up. > index := index + 2 // because a frame is always two times a throw > > > Now I wonder if this is a valid smalltalk to do this > > Roelof > >