Created
November 5, 2016 14:06
-
-
Save eternaltung/7dbf5452010b387ff2632c29c14790cb to your computer and use it in GitHub Desktop.
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
static void Main(string[] args) | |
{ | |
string sign = "*"; | |
string empty = " "; | |
string heart = "*"; | |
int max = 45; | |
int height = 3; | |
int space = 5; | |
Console.WriteLine(); | |
// heart | |
DrawHeart(empty, heart, max); | |
// candle | |
for (int i = 0; i < 2; i++) | |
{ | |
for (int j = 0; j < max; j++) | |
Console.Write((j == max / 2) ? sign : empty); | |
Console.WriteLine(); | |
} | |
// top | |
int left = space * 3 - 1; | |
int right = max - space * 3; | |
BuildCake(empty, max, height, left, right); | |
// second | |
left = space * 2 - 1; | |
right = max - space * 2; | |
BuildCake(empty, max, height, left, right); | |
// third | |
left = space - 1; | |
right = max - space; | |
BuildCake(empty, max, height, left, right); | |
// bottom | |
for (int i = 0; i < max; i++) | |
Console.Write("-"); | |
} | |
private static void DrawHeart(string empty, string heart, int max) | |
{ | |
for (int i = 0; i < max; i++) | |
{ | |
if ((i >= (max / 2 - 4) && (i < max / 2 - 1)) || (i > (max / 2 + 1) && i <= (max / 2 + 4))) | |
Console.Write(heart); | |
else | |
Console.Write(empty); | |
} | |
Console.WriteLine(); | |
for (int i = 0; i < max; i++) | |
{ | |
if ((i == max / 2 - 5) || (i == max / 2 - 1) || | |
(i == max / 2 + 1) || (i == max / 2 + 5)) | |
Console.Write(heart); | |
else | |
Console.Write(empty); | |
} | |
Console.WriteLine(); | |
for (int i = 0; i < max; i++) | |
{ | |
if ((i == max / 2) || (i == max / 2 - 5) || (i == max / 2 + 5)) | |
Console.Write(heart); | |
else | |
Console.Write(empty); | |
} | |
Console.WriteLine(); | |
for (int i = 2; i >= 0; i--) | |
{ | |
for (int j = 0; j < max; j++) | |
{ | |
if (j == (max / 2 - i * 2) || j == (max / 2 + i * 2)) | |
Console.Write(heart); | |
else | |
Console.Write(empty); | |
} | |
Console.WriteLine(); | |
} | |
} | |
private static void BuildCake(string empty, int max, int height, int left, int right) | |
{ | |
HorizontalCake(empty, max, left, right); | |
Console.WriteLine(); | |
VerticalCake(empty, max, height, left, right); | |
} | |
private static void VerticalCake(string empty, int max, int height, int left, int right) | |
{ | |
for (int i = 0; i < height; i++) | |
{ | |
for (int j = 0; j < max; j++) | |
{ | |
Console.Write((j == left + 1 || j == right - 1) ? "|" : empty); | |
} | |
Console.WriteLine(); | |
} | |
} | |
private static void HorizontalCake(string empty, int max, int left, int right) | |
{ | |
for (int i = 0; i < max; i++) | |
Console.Write((i > left && i < right) ? "-" : empty); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment