Jump to content
IGNORED

Bowling Scoring


easmith

Recommended Posts

   I have often struggled with 2600 specific programming issues , such as TIA timing and graphics  , but trying to do scoring for my bowling game   is kicking my butt.  This is the first real "logic  problem " that is stumping me.

 

  I have it working for updating score after a single spare or strike, but the problem is for consecutive strikes, spares , or strike-spare runs, because of the backwards cascading that results . 

 

  Further complicating things is the fact that not every frame is two shots if there are strikes .

  I feel like I might need some kind of fancy array or data structure that

 

 I would appreciate any advice from more experienced programmers.   !

Link to comment
Share on other sites

I might be misunderstanding  scoring rules :

 

  lets say the scores are 

frame     1         2          3  

            3 ,4      X       3 , 5

 

  I     basically double count the 3 and 5 , no problem 

 

  lets say scores are 

frame     1             2         3

            3, 4        4, 6      3,5

 

 I double count the    3 after the spare, no problem

 

 

 

Suppose the score is 

frame    1        2     3         4

            3,4     X     X       4, 5

I double count the  10 and the 4 after frame 2 .

I double count the 4 and 5 because of the second strike , which changes effectively changes the  frame 3 score to 19.

 

The question is does this now also affect the frame 2 score which depends on frame 3  ???   If no, then my current scoring algorithm should work, if yes, then I am stuck .

 

I think the answer is that it does not , but not sure ....

 

 

Edited by easmith
Link to comment
Share on other sites

3 hours ago, easmith said:

 

The question is does this now also affect the frame 2 score which depends on frame 3  ???   If no, then my current scoring algorithm should work, if yes, then I am stuck .

 

I think the answer is that it does not , but not sure ....

 

I believe it does not also.

 

A strike gives you ten points, plus the score of your next two balls. It has nothing to do with the score in the next frame, per se.

 

https://slocums.homestead.com/gamescore.html

 

And yeah, I guess you would need to use some sort of array. Put a special "placeholder" in a location for strikes and spares. After each ball, scan for placeholders and update any that you now have enough throws to calculate a value for.

 

I was thinking you could use the stack, but that's a LIFO data structure, and bowling score placeholders are FIFO. ?

 

Disclaimer: I am not much of a bowler. And the last time I bowled, it was candlepin bowling, which is a whole 'nother kettle of fish... 

 

Edited by JeffJetton
Link to comment
Share on other sites

Since strikes are 10 + result of next two rolls.  Spares give you 10 + the result of the next roll.  

 

So for a scenario where you have the following, where you hit spares on every frame except for the 10th frame where you strike out.   In the following as you hit each 9, you can do a look ahead to see your bonus roll, and add it to your frame total.  When you get out to the 10th frame, if you strike on the first roll, we stop counting there and look ahead at the next two rolls.  

                                                                             

0  1   2  3  4  5  6  7  8  9  10  11 12 13 14 15 16 17 18 19 20 

1  9   1  9  1  9  1  9  1  9  1    9   1   9   1   9   1   9  10 10 10  

 

So all that said, your first frame is a spare.  To populate the first frame, you do the look ahead for the one roll which is a 1 so your first frame is 11.

Second frame calculates out the same, so it ends up going 11, 22, 33 until you get to the 9th frame.  You get the spare, so you look ahead to next roll which is a 10, so add that and you're at 108.  Get to 10th frame, you see the strike and stop there, but then do the look ahead to the next two rolls (which are themselves strikes)

 

What about spare strike in the 10th?  The spare looks ahead to the next roll (slot 20) which is the strike (so there's your 20).  

 

0  1   2  3  4  5  6  7  8  9  10  11 12 13 14 15 16 17 18 19 20 

1  9   1  9  1  9  1  9  1  9  1    9   1   9   1   9   1   9  1   9  10  

 

Not sure if that makes 100 percent sense.   Sorry for all the edits.  Going a little too stream of consciousness for my liking.

 

Bottom line is you need an array.  Nothing fancy.  Just enough to hold 21 rolls

 

Edited by ForceInfinity
optimizing the algorithm on the fly since no option to delete post
Link to comment
Share on other sites

1 hour ago, ForceInfinity said:

Since strikes are 10 + result of next two rolls.  Spares give you 10 + the result of the next roll.  

 

So for a scenario where you have the following, where you hit spares on every frame except for the 10th frame where you strike out.   In the following as you hit each 9, you can do a look ahead to see your bonus roll, and add it to your frame total.  When you get out to the 10th frame, if you strike on the first roll, we stop counting there and look ahead at the next two rolls.  

                                                                             

0  1   2  3  4  5  6  7  8  9  10  11 12 13 14 15 16 17 18 19 20 

1  9   1  9  1  9  1  9  1  9  1    9   1   9   1   9   1   9  10 10 10  

 

So all that said, your first frame is a spare.  To populate the first frame, you do the look ahead for the one roll which is a 1 so your first frame is 11.

Second frame calculates out the same, so it ends up going 11, 22, 33 until you get to the 9th frame.  You get the spare, so you look ahead to next roll which is a 10, so add that and you're at 108.  Get to 10th frame, you see the strike and stop there, but then do the look ahead to the next two rolls (which are themselves strikes)

 

What about spare strike in the 10th?  The spare looks ahead to the next roll (slot 20) which is the strike (so there's your 20).  

 

0  1   2  3  4  5  6  7  8  9  10  11 12 13 14 15 16 17 18 19 20 

1  9   1  9  1  9  1  9  1  9  1    9   1   9   1   9   1   9  1   9  10  

 

Not sure if that makes 100 percent sense.   Sorry for all the edits.  Going a little too stream of consciousness for my liking.

 

Thanks . If this is the case then I think my current system will work . It was thinking about cascading backward effects that was blowing my mind , like if you had two strikes  in a row , would the bonus score for the second strike then need to be applied back to the first strike bonus . But I think I understand now that the answer is no . I have not bowled much in the last many years and scoring is now all done automatically . 

 

My current system simply looks back at the previous 2 shots encoded as 0,1, or 2 for no spare, spare , or strike and if the previous shot was a spare or strike , or if 2 shots back was a strike , then the score is doubled for that shot . 

 

I will test it using the links that have been shared . Thanks ? 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...