World Cup Frenzy (retired)
Description:
I am a huge fan of the FIFA world cup. However, I am currently in the EST timezone which means I miss most of the games because I am at work. I usually keep live track of the scores though. One of my favorite things to do upon seeing the final score is to play out the goal-scoring orders that may have led to that outcome. I tried counting them one time and my brain froze. That's what code is for, amirite?
Task
Given the final score of a football (soccer if that's what rocks your boat) match, provide the count of all the possible orderings of the goals that were scored.
The function you write will take in a string that represents the final game score as an argument. It is expected to always return a number.
Example
Final score: 3-1
Count: 4
Explanation: The possible orderings include:
- team A scored 3 goals, then team B scored 1 goal
- team A scored 2 goals, then team B get one back, then team A score final goal, crushing their opponents' hopes
- team A scored 1 goal, then team B equalized, then team A scored two more goals
- team B scored the first goal but team A pulled an upset comeback by scoring three goals
Notes
- There will be an unrealistic number of goals being scored, so count efficiently.
- We are not accounting for either of the two halves of the game i.e. no need to try and count whether a goal is scored in the first half or the second half. That will probably be for a later kata.
Similar Kata:
Stats:
Created | Dec 8, 2022 |
Warriors Trained | 11 |
Total Skips | 0 |
Total Code Submissions | 69 |
Total Times Completed | 10 |
Python Completions | 10 |
Total Stars | 0 |
% of votes with a positive feedback rating | 25% of 6 |
Total "Very Satisfied" Votes | 1 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |