Hello Richard,
I do it afterwards the input looks like this : #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 7). and I solved it already like this : scoreAfterRolling: aCollection | score | score := 0. 1 to: aCollection size - 1 by: 2 do: [ :index | score := (aCollection at: index) = 10 ifTrue: [ score + 10 + (aCollection at: index + 1) + aCollection at: index + 2 ] ifFalse: [ (aCollection at: index) + (aCollection at: index + 1) = 10 ifTrue: [ score + 10 + aCollection at: index + 2 ] ifFalse: [ score + (aCollection at: index) + (aCollection at: index + 1) ] ] ]. ^ score but the problem I facing now that I see when someone throws a strike I do not need a step of 2 but a step of 1 I tried to make a custom step variable but that did not do the job. So right now thinking how to get out of this Roelof Op 13-4-2019 om 11:37 schreef Richard O'Keefe:
|
- [Pharo-users] is this a valid Smalltalk way Roelof Wobben
- Re: [Pharo-users] is this a valid Smalltalk way Richard O'Keefe
- Re: [Pharo-users] is this a valid Smalltalk way Roelof Wobben