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

Stats:

CreatedJan 1, 2016
PublishedJan 1, 2016
Warriors Trained736
Total Skips41
Total Code Submissions2296
Total Times Completed375
Ruby Completions52
Python Completions177
JavaScript Completions167
Total Stars23
% of votes with a positive feedback rating88% of 127
Total "Very Satisfied" Votes104
Total "Somewhat Satisfied" Votes15
Total "Not Satisfied" Votes8
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • taw Avatar
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • bidouille Avatar
  • farhanaditya Avatar
Ad