Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class ProgrammerDNA
- {
- public static char[] letters = new char[7];
- static void Main()
- {
- int size = int.Parse(Console.ReadLine());
- char ch = char.Parse(Console.ReadLine());
- int asciiCode = Convert.ToInt32(ch);
- FillArrayOfChars(asciiCode);
- bool direction = true;
- int symbol = 0;
- int dot = 3;
- for(int row = 0,diamond = 0; row < size; row++,diamond++)
- {
- if(diamond != 0 && diamond % 7 == 0)
- {
- if (symbol == 7)
- {
- symbol = 0;
- }
- Console.WriteLine("{0}{1}{0}", new string('.',3),letters[symbol]);
- symbol++;
- continue;
- }
- Console.Write("{0}", new string('.',dot));
- for(int col = 0;col < 7-dot*2; col++)
- {
- if (symbol == 7)
- {
- symbol = 0;
- }
- Console.Write("{0}",letters[symbol]);
- symbol++;
- }
- Console.Write("{0}", new string('.',dot));
- Console.WriteLine();
- if(direction)
- {
- if(dot == 0)
- {
- direction = false;
- dot++;
- continue;
- }
- dot--;
- }
- if(!direction)
- {
- if(dot == 3)
- {
- direction = true;
- dot--;
- continue;
- }
- dot++;
- }
- }
- }
- private static void FillArrayOfChars(int charNum)
- {
- for (int i = 0; i < 7; i++)
- {
- if (charNum == 72)
- {
- charNum = 65;
- }
- letters[i] = (char)(charNum);
- charNum++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment