0
[I decided to salvage Ben Reich's question How many unique ways are there to achieve a score in Football? but it ended up being so different that it's only suitable as its own question not spliced into his.]
Challenge: Given a number, calculate how many order-independent ways there are to score that number as a winning football score.
The following ways are possible to score:
- Touchdown + kick failure: 6 points
- Touchdown + extra point or safety: 7 points
- Touchdown + conversion: 8 points
- Field goal: 3 points
- Safety: two points
- Safety during opponent's conversion play: 1 point
Careful how you set this up. You can score ones by the safety play on the end of the list, but arbitrary numbers of ones because each one means your opponent scored six points. This means there is no way to win with a score of 1.
9 as input should return 7
- 1 touchdown + extra point and 1 safety
- 1 touchdown + conversion and 1 safety
- 1 touchdown and 1 field goal
- 3 field goals
- 1 field goal and 3 safeties
- 2 field goals and one safety and one conversion safety
- 4 safeties and 1 conversion safety
Because the score is less than 13, only 1 1 can be used here. 13-18 allows 2 1s, etc.
Why do you propose this isn't a duplicate of the earlier questions? – xnor – 2016-01-09T19:17:24.093
@xnor: Changing the constants doesn't work because this time there's a maximum number of something. – Joshua – 2016-01-09T19:22:24.287
1I am failing to parse "You can score ones by the safety play on the end of the list, but arbitrary numbers of ones because each one means your opponent scored six points." Can you explain for the benefit of someone who knows nothing about American football? – Peter Taylor – 2016-01-09T21:15:07.313
In order to score a 1, your opponent must have just scored a 6. If they get too many sixes, you don't have a winning score. – Joshua – 2016-01-09T23:47:09.003