Re: [exercism bowling challenge] Is there a better way to do this
Posted by
Pharo Smalltalk Users mailing list on
Dec 21, 2020; 3:42pm
URL: https://forum.world.st/exercism-bowling-challenge-Is-there-a-better-way-to-do-this-tp5125521p5125524.html
Op 21-12-2020 om 13:56 schreef Russ Whaley:
> I had a lot of fun putting my bowling game together back when you
> first brought this up.
>
> I have a Bowling (Game) class, a Frame class, aThrow class and a
> Score(ing) class. I made the Throws a class that I put in an
> OrderedCollection - but instVars would work as well... the rest of
> your game should be oblivious to your 'underpinnings' anyway.
>
> The Bowling class controls the game and cycles through 10 frames,
> which I create then house in an OrderedCollection at the start of the
> game. Frame has a subclass called Frame10 that is instantiated for
> the 10th frame of the game.
>
> Bowling processes each Frame, starting at 1, from the collection, and
> does a runFrame (or whatever action name you want). A Frame consists
> of throws, 1, 2, or 3 - depending on the frame and the result of the
> first throw.
>
That is also the way I can work.
But I do not see how I can convert the given collection to frames
Roelof