In light of the World Series being around the corner, I need a program that can read the box scores and tell me what inning it is. This is complicated slightly because baseball uses an odd method to record the score. They don't write down the at-bat team's score for the inning until they've scored a run (and are still going) or have finished their at-bat. Thus a 0 on the scoreboard always means a finished at-bat. For example:
Example A: Inning| 1| 2| 3| 4| 5| 6| 7| 8| 9| Them| 0| 0| 0| 0| 0| 2| | | | Us| 0| 0| 2| 0| 0| 0| | | | Example B: Inning| 1| 2| 3| 4| 5| 6| 7| 8| 9| Them| 0| 0| 0| 0| 0| 2| | | | Us| 0| 0| 2| 0| 0| 1| | | | Example C: Inning| 1| 2| 3| 4| 5| 6| 7| 8| 9| Them| 0| 0| 0| 0| 0| 2| | | | Us| 0| 0| 2| 0| 0| | | | | #Them is the Away Team, Us is the Home Team (who are the guys you root for)
- Example A: We know we're at the top of the 7th because Us has a recorded 0 in the Bottom of the 6th and the Top of the 7th is blank.
- Example B: It can either be the Bottom of the 6th or the Top of the 7th.
- Example C: It can either be the Top or Bottom of the 6th.
Your task is to return which inning(s) it could be.
Two lists of non-negative integers. Lists will be assumed jagged with the Away team's list being either the same size or one element larger in comparison to the Home team's. You can take the scores in either order but state in your answer if you do not use the default. I.e., Away Team then Home team (the default), or Home team then Away team (reversed). They can also be padded with dummy data if you want, state in your answer if you do so.
A string or something equivalent which identifies the inning number and whether it's the top or bottom. E.g.
['7B','8T'] are all fine. If there are two answers, you must output both. The format is pretty flexible though.
- Input will always be valid
- Games can go into indefinite extra innings. Your program should be able to support up to 255 innings.
- Standard Loopholes are forbidden
- This is code-golf so shortest code wins
#Input: [, ] #Output: 1T #Input: [, ] #Output: 1B #Input: [[0,0,0,1], [0,0,0,0]] #Output: 5T #Input: [[0,0,0,1], [0,0,0,1]] #Output: 4B, 5T #Input: [[0,0,0,1,0,0,1,0,0,1], [0,0,0,0,1,0,0,1,0,1]] #Output: 10B, 11T #Input: [[0,0,0,1], [0,0,0]] #Output: 4T, 4B #Input: [[0,0,0,0], [0,0,0]] #Output: 4B