6 kyu
Regexp basics - parsing mana cost
52 of 375taw
Description:
Implement String#parse_mana_cost
, which parses Magic: the Gathering mana costs expressed as a string and returns a Hash
with keys being kinds of mana, and values being the numbers.
Don't include any mana types equal to zero.
Format is:
- optionally natural number representing total amount of generic mana (use key
*
) - optionally followed by any combination of
w
,u
,b
,r
,g
(case insensitive in input, return lower case in output), each representing one mana of specific color.
If case of Strings not following specified format, return nil/null/None
.
Regular Expressions
Fundamentals
Similar Kata:
Stats:
Created | Jan 1, 2016 |
Published | Jan 1, 2016 |
Warriors Trained | 736 |
Total Skips | 41 |
Total Code Submissions | 2296 |
Total Times Completed | 375 |
Ruby Completions | 52 |
Python Completions | 177 |
JavaScript Completions | 167 |
Total Stars | 23 |
% of votes with a positive feedback rating | 88% of 127 |
Total "Very Satisfied" Votes | 104 |
Total "Somewhat Satisfied" Votes | 15 |
Total "Not Satisfied" Votes | 8 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |