Last active
August 29, 2015 14:16
-
-
Save RussellAndrewEdson/eb8c0902553f5dac5185 to your computer and use it in GitHub Desktop.
Rule 2 for the MIU System.
This file contains 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
# Returns true if we can apply Rule 2 to the given string. | |
# (Rule 2: If our string looks like Mx, we can change it to Mxx.) | |
def can_apply_rule2?(str) | |
str.start_with?("M") | |
end | |
# Applies Rule 2: We replace the string Mx with Mxx. | |
def apply_rule2(str) | |
str + str[1, str.length] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment