Skip to content

Instantly share code, notes, and snippets.

@RussellAndrewEdson
Last active August 29, 2015 14:16
Show Gist options
  • Save RussellAndrewEdson/eb8c0902553f5dac5185 to your computer and use it in GitHub Desktop.
Save RussellAndrewEdson/eb8c0902553f5dac5185 to your computer and use it in GitHub Desktop.
Rule 2 for the MIU System.
# 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