Created
September 5, 2014 08:54
-
-
Save rummelonp/44bf0b8482e1e5a86bd6 to your computer and use it in GitHub Desktop.
ID の強さ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tuyosa(id) | |
score = 50 | |
score -= (id.size - 1) | |
id.chars.each do |char| | |
score -= 1 if char =~ /_/ | |
score -= 1 if char =~ /[A-Z]/ | |
score -= 2 if char =~ /[0-9]/ | |
end | |
score * 2 | |
end | |
ARGV.each do |id| | |
puts "#{id}: #{tuyosa(id)}" | |
end |
Author
rummelonp
commented
Sep 5, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment