Skip to main content
3 of 4
added 70 characters in body
RamenChef
  • 1.2k
  • 6
  • 9

Making a Mountain out of a Molehill

(I'm not sure what other tags to give this)


You are given a string of terrain, with molehills and mountains:

 /\ / \ _/\__ / \ ___/ \_/ \_ ____/\___/ \___ 

Your job is to replace every molehill in the string with an equivalent mountain centered in the same column. The rest of the string must be unaffected. This may require additional lines at the beginning of the string.

A molehill consists of adjacent columns where the terrain goes up, immediately followed by adjacent columns where the terrain goes down. The shortest side must be exactly one column wide.

These are all molehills:

_____/\______ /\________ __/ ________/\ \__ \ / \ / \ / \ / \/\_/ 

These are not molehills:

 /\ ___/ \______ ___ _____/ \___ ____ _______ \/ 

A mountain is like a molehill, but the shortest side is four lines high instead of one.

Examples

 /\ / \ -> / \ ____/\____ _/ \_ /\ / \ / \ __ -> / \__ _ /\__/ __/ \___/ /\ / \ -> / \ /\ /\/ \ _/ \__/\_____ _/ \_ _ _ _ _ \ / \ /\ / \ / \ / \ / \ / \ / \ / \ / -> \/ \/ \ / \ / \/\/ /\ /\ / \ / \ / \ / \ _ -> _/ \/ \ \ \ \ \ \/\______/\_______ \_ /\ /\ /\ / \ /\ / \ / \ _/\__ / \ -> / \ / \ / \ ___/ \_/ \_ / \ __/ \_/ \_ ____/\___/ \___ _/ \/ \___ 

Additional Rules

  • Standard loopholes are forbidden.
  • Input and output can be in any reasonable format.
  • You may assume the presence or absence of trailing whitespace in the input string.
  • There will always be enough space in the sides of the string as well as between molehills for any mountains you might need.
  • If replacing the molehills with mountains creates additional molehills, you do not need to turn those molehills into mountains.
  • The terrain cannot go both up and down in the same column. If this happens, the terrain does not move.

This is , so the shortest answer in bytes wins.

RamenChef
  • 1.2k
  • 6
  • 9