# Make me an Easter egg!

No, not the ^^vv<><>BA kind of Easter eggs, real Easter eggs that we paint.

Here is an (awfully drawn) egg.

  __
/  \
/    \
|    |
\____/


In easter, we paint them with patterns. Like these:

  __
/--\
/----\
|----|
\____/
__
/%%\
/%%%%\
|%%%%|
\____/
__
/~~\
/~~~~\
|~~~~|
\____/


# The challenge

Given a character (printable ascii) to paint the egg, print the painted egg.

Examples:

&:
__
/&&\
/&&&&\
|&&&&|
\____/

#:
__
/##\
/####\
|####|
\____/


# Specs

• Trailing newlines/spaces are allowed.
• Why the downvote? If you do not like this question, downvote then leave a reason please. Apr 14, 2017 at 14:41
• One potential reason might be that they don't think this task is clear enough or clear enough. I'd say it is clear enough, and it's not literally trivial either. That said, I'm not particularly excited either. Apr 14, 2017 at 14:43
• The challenge will be very trivial in most languages. The egg is too short to allow much originality in the golfing. In my opinion, it's an uninteresting challenge (that hasn't been sandboxed, because you seem to be boycotting the sandbox for I don't know what reasons), therefor, I downvote it.
Apr 14, 2017 at 14:53
• Upvoted because simple challenges like this are great for beginners like me to ease into golf. Apr 14, 2017 at 15:40
• POOF! You're an easter egg. (Sorry, couldn't resist) Apr 14, 2017 at 20:16

# Pyth, 36 bytes

jm:s@L"-/|\\_ "jCd6\-+QQ"ԈџÛƲ獩


Try it online!

# Swift - 88 bytes

var f={x in"  __\n /&&\\\n/&&&&\\\n|&&&&|\n\\____/".replacingOccurrences(of:"&",with:x)}


Lambda-like function with usage: print(f("x")).

Try it out here!

NOTE: In some environments, as in the one linked above, this requires import Foundation, but on a standard project it doesn't. That's because replacingOccurrences() belongs to Foundation, but Xcode projects have that optimised, and is not required.

• The replacingOccurrences() really kills the score :(( Apr 14, 2017 at 16:19

## c(gcc) 81 78 bytes

*s;f(c){for(s=LR"(  __
/00\
/0000\
|0000|
\____/)";*s;s++)printf(*s%6?s:&c);}


Try it online

## Batch, 76 bytes

@for %%l in ("  __" " /%1%1\" "/%1%1%1%1\" "|%1%1%1%1|" \____/)do @echo %%~l


Note: To run this with special characters such as &, prefix the character with a ^.

# Bash, 50 bytes

echo "  __
/$1$1\\
/$1$1$1$1\\
|$1$1$1$1|
\____/"


I've also tried to do pattern substitution during parameter expansion, but it seems like the most straightforward way to do this is also the shortest.

Try it online!

• Neither I managed to reduce a pure Bash solution, but Bash + coreutils would be shorter: tr . "$1"<<<' __␤ /..\␤/....\␤|....|␤\____/'. Apr 15, 2017 at 15:45 # JavaScript (ES6), 55 bytes x=> __ /0\\ /00\\ |00| \\____/.replace(/0/g,_=>x+x)  • This wont work if x === '$', 3 more bytes are needed: .replace(/0/g,_=>x+x)
– tsh
Apr 15, 2017 at 7:11
• @tsh Ah dang it. I actually had it like that originally, but I thought I could remove the _=>... Apr 15, 2017 at 13:59

# Vim, 31 bytes

Expects the input character to be the only thing in the buffer to start. Ends in insert mode with the egg displayed in the buffer. I have replaced ^M and ^O with <CR> and <C-O> for readability. All whitespace is significant.

s  __<CR> /<C-O>2p\<CR>/<C-O>4p\<CR>|<C-O>4p|<CR>\____/


Since V is backwards-compatible, you can Try it online!

Explanation:

s                                                       " Delete input (storing it to the default register) and enter insert mode
__<CR>                                               " Type "  --\n"
/                                             " Type " /"
<C-O>2p                                      " Paste twice from the default register without leaving insert mode (e.g. put "%%")
\<CR>                                 " Type "\\\n"
/                                " Type "/"
<C-O>4p                         " This time paste 4 times
\<CR>                    " Type "\<CR>"
|<C-O>4p|<CR>       " Same drill, but with | before and after
\____/ " The bottom of the egg


# C#, 140 Bytes

class x{static void Main(){System.Console.WriteLine(("  __\n"+@" /%%\"+'\n' +@"/%%%%\"+'\n'+@"|%%%%|"+'\n' +@"\____/ ").Replace("%","A"));}}


It's my first time codegolfing :) Anyway, this works by replacing '%' from the example to any character you want. This prints out:

  __
/AA\
/AAAA\
|AAAA|
\____/

• The egg should be painted with the character given in input line.
– Toto
Apr 16, 2017 at 10:08

# JS (ES6), 60 bytes

x=>  __
/~\\
/~~\\
|~~|
\\____/.replace(/~/g,x.repeat(2))


Basically the same thing as the python answer.

# Java 7, 79 bytes

String f(String c){return"  __\n /x\\\n/xx\\\n|xx|\n\\____/".replace("x",c+c);}


Explanation:

String f(String c){                           // Method with String(-character) parameter and String return-type
return "  __\n /x\\\n/xx\\\n|xx|\n\\____/"  //  Return this String
.replace("x",c+c);                        //  And replace every 'x' with two times the input String-character
}                                             // End of method


Test code:

Try it here.

class Main{
static String f(String c){return"  __\n /x\\\n/xx\\\n|xx|\n\\____/".replace("x",c+c);}

public static void main(String[] a){
System.out.println(f("^"));
System.out.println(f("|"));
System.out.println(f("o"));
}
}


Output:

  __
/^^\
/^^^^\
|^^^^|
\____/
__
/||\
/||||\
||||||
\____/
__
/oo\
/oooo\
|oooo|
\____/


# C, 49 bytes

f(){puts("  __\n /~~\\n/~~~~\\n|~~~~|\n\____/");}


Output Live

  __
/~~\
/~~~~\
|~~~~|
\____/


Unicode, 77 bytes

g(){printf("  .\u2322.\n\n\u239bHAPPY\u239e\n EASTER\n\u239d.___.\u23a0\n");}


Output

  .⌢.

⎛HAPPY⎞
EASTER
⎝.___.⎠


# Common Lisp, SBCL, 73 bytes

(format t"  __
/~@?\\
/~@?~@?\\
|~@?~@?|


## ><>, 58 bytes

|v"  __   /":{"\ /"}::::{"\|"}::::i"|\____/"
o>ooooool?!;a


Try it online, or at the fish playground!

Takes input from STDIN. If you're allowed to exit with an error, you can get rid of the l?!; in the second line.

Explanation: The fish swims through the first line backwards, so it reads "/____\|"i::::}"|\"{::::}"/ \"{:"/ __ ". This builds up the string in reverse, keeping a copy of the input at the back of the stack for when it's needed again. The fish then gets to row 2, which prints six characters and a newline and then loops until the stack is empty.

puts"  __  \n /00\\ \n/0000\\\n|0000|\n\\____/".gsub"0",$*[0]  As basic as it gets, honestly # Excel VBA, 66 Bytes Anonymous Excel VBE immediates window function that takes a clean input of 1 character from cell [A1] on the ActiveSheet object and prints to the VBE immediate window. ?Replace(Replace(" __0 /11\0/1111\0|1111|0\____/",0,vbCr),1,[A1])  # 05AB1E, 25 bytes "ÿ_ \/|"•θ8Ë1Âõ]Æ°•6вèJ.c  Try it online. Explanation: "ÿ_ \/|" # Push the string "ÿ\n\/|", where ÿ is automatically filled # with the (implicit) input-character •θ8Ë1Âõ]Æ°• # Push compressed integer 1269961759550053939510 6в # Converted to Base-6 as list: # [1,1,2,4,0,0,3,2,4,0,0,0,0,3,2,5,0,0,0,0,5,2,3,1,1,1,1,4] èJ # Index each into the string, and then join together .c # And centralize it to add the appropriate leading spaces # (after which the result is output implicitly)  See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why •θ8Ë1Âõ]Æ°• is 1269961759550053939510 and •θ8Ë1Âõ]Æ°•6в is [1,1,2,4,0,0,3,2,4,0,0,0,0,3,2,5,0,0,0,0,5,2,3,1,1,1,1,4]. # Excel Formula, 54 bytes Makes use of multi-line entry in the formula bar (Alt+Enter), where # is your chosen character to paint! =SUBSTITUTE(" __ /~~\ /~~~~\ |~~~~| \____/","~","#")  # Whitespace, 240 229 bytes [S S S T S T T T T N _Push_47][S S S T S T T T T T N _Push_95][S N S _Duplicate_95][S N S _Duplicate_95][S N S _Duplicate_95][S S S T S T T T S S N _Push_92][S S S T S T S N _Push_10][S S S T T T T T S S N _Push_124][S T S S T S N _Copy_0-based_2nd_(92)][S N S _Duplicate_92][T N T S _Read_STDIN_as_character][T T T _Retrieve][S N S _Duplicate_input][S N S _Duplicate_input][S N S _Duplicate_input][S S S T T T T T S S N _Push_124][S S S T S T S N _Push_10][S T S S T S S S N _copy_0-based_8th_(92)][S N S _Duplicate_92][T T T _Retrieve][S N S _Duplicate_input][S N S _Duplicate_input][S N S _Duplicate_input][S S S T S T T T T N _Push_47][S S S T S T S N _Push_10][S S S T S T T T S S N _Push_92][S N S _Duplicate_92][T T T _Retrieve][S N S _Duplicate_input][S T S S T S S N _Copy-0-based-4th-(47)][S S S T S S S S S N _Push_32][S S S T S T S N _Push_10][S S S T S T T T T T N _Push_95][S N S _Duplicate_95][S T S S T T N _Copy-0-based-3rd-(32)][S N S _Duplicate_32][N S S N _Create_Label_LOOP][T N S S _Print_as_character][N S N N _Jump_to_Label_LOOP]  Letters S (space), T (tab), and N (new-line) added as highlighting only. [..._some_action] added as explanation only. Explanation: Since we have to incorporate the input character in the output, I couldn't apply this Whitespace tip of mine which I always use for ASCII-art or other print challenges in Whitespace, which would lower each value and inside the printing loop add it again. So instead this is a pretty simple program which does the following: 1. Push all characters reversed to the stack, including the input-characters • With bytes saved using Duplicates and Copy's-of 2. Then loop and print the characters from the top of the stack to the bottom (which is why we push the characters in reverse order). # Haskell, 70 63 bytes 7 bytes down with great help from Laikoni (<$>"  __\n /~~\\\n/~~~~\\\n|~~~~|\n\\____/").(?)
d?'~'=d
d?c=c


Try it online!

The function f takes a character to paint the egg with.

• You can use >'z' instead of =='~'. Flipping the arguments of ? allows for a shorter pointfree notation: (<\$>" ... ").(?). Try it online! Apr 29, 2019 at 5:53
• Using pattern matching for (?) is even shorter: d?'~'=d;d?c=c. Try it online! Apr 29, 2019 at 5:58

# Scala, 56 bytes

print("""  __
/~\
/~~\
|~~|
\____/""".replace("~",i+i))


Try it online!

# T-SQL, 63 61 bytes

SELECT REPLACE('  __
/11\
/1111\
|1111|
\____/',1,v)FROM t


Old challenge, but didn't see a SQL solution.

Input is taken via pre-existing table t with text field v, per our IO standards.

SQL allows line break literals in strings, so a pretty straight-forward replace. Lines 2 and 3 have an extra space after the final \, so the line break isn't escaped.

EDIT: Discovered that I can save 2 bytes by using a numeral as the replacement character instead of something like '.' that needs quotes. Turns out REPLACE does the implicit conversion to string.

# Aceto, 68 64 bytes

8 by 8, so a 3rd order Hilbert curve.

/"ppp(pp
np(p"pp)
\\)p|n
"\"\\\
)k,p\\n"
pp/"__\|
n__
"__\/"p


Since we're already non-competing, I used features introduced after the question was posted.

Output:

  __
/==\
/====\
|====|
\____/