Skip to content

Instantly share code, notes, and snippets.

@ParadoxV5
Created May 14, 2025 01:51
Show Gist options
  • Save ParadoxV5/7d13ea8b5e2e6221b5eb737c153136fd to your computer and use it in GitHub Desktop.
Save ParadoxV5/7d13ea8b5e2e6221b5eb737c153136fd to your computer and use it in GitHub Desktop.
Sow and Tell – Ruby Discord Mother’s Day 2025 challenge
puts$*[0].gsub(/(.)\1*/){'_🌷🌼🪻'[it.size]+$1}
# This extends the language of flowers beyond 1–3 just to be ridiculous. 😁
FLOWER = Hash.new(capacity: 3) do|h, n| #$ Integer, String
h[n] = (957*n*n - 2866*n + 129708).chr(Encoding::UTF_8)
end # { 1=>'🌷', 2=>'🌼', 3=>'🪻' }
ARGV.each do|input|
puts input.gsub(/(.)\1*/) { "#{FLOWER[it.size]}#{Regexp.last_match(1)}" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment