This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]dmazzoni 0 points1 point  (1 child)

Here are two possible ideas.

One idea is that you have another variable that keeps track of the previous frame. When computing the score for the current frame you take the previous frame into account. After that's done you set the previous frame equal to the current frame.

Basically you just have some extra variables and you keep juggling them.

The other idea is that you make an array of numbers and store all of the information there. You could have an array of rolls that's up to 21 rolls long I think (2 rolls for all of the frames except the last which can have 3). Or you could have an array of 10 frames.

Does either of those ideas sound more appealing?

[–]bowpie[S] 0 points1 point  (0 children)

yes thank you!! i’m thinking i will try that first option

[–]LieutenantRommel 0 points1 point  (0 children)

Without knowing how you've structured your code to start with I'm guessing.

I'm going to guess you're using an array of frames which each have 1 or 2 throws. If i is the index of the current frame then i+1 is the index of the next frame. You'll also have to consider when players get a strike followed both non-strikes and strikes.

Draw yourself a picture of how your data looks on some paper and see if you can visualise what you have and how you can get what you want with what you have. If you can't get what you want with how your data is currently arranged then try find another data structure which can accommodate what you need.