Advertisement
Guest User

Programmer DNA

a guest
May 3rd, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. class Program
  9. {
  10.     static void printDNA(char firstLetter)
  11.     {
  12.  
  13.     }
  14.     static void Main(string[] args)
  15.     {
  16.         int howManyLines = Int32.Parse(Console.ReadLine()); ;
  17.         char firstLetter = char.Parse(Console.ReadLine());
  18.         bool up = true, down = false;
  19.         bool restart = false;
  20.         char[] Tletters = {'o','A', 'B', 'C', 'D', 'E', 'F', 'G'};
  21.         int index = Array.IndexOf(Tletters, firstLetter);
  22.         int counter = 1;
  23.  
  24.         for (int i = 0; i < howManyLines; i++)
  25.         {
  26.             Console.Write("{0}", new string('.', (7 - counter) / 2));
  27.             for (int j = 0; j < counter; j++)
  28.             {
  29.  
  30.                 string format = Tletters[index].ToString();
  31.                 Console.Write(format);
  32.                 ;
  33.                 index++;
  34.                 if (index > 7)
  35.                 {
  36.                     index = index % 7;
  37.                 }
  38.             }
  39.             Console.Write("{0}", new string('.', (7 - counter) / 2));
  40.             if (counter <= 5 && down == false)
  41.             {
  42.                 up = true;
  43.             }
  44.             else if (counter == 7)
  45.             {
  46.                 down = true;
  47.             }
  48.             Console.WriteLine();
  49.             if (restart == true)
  50.             {
  51.                 counter -= 2;
  52.                 restart = false;
  53.             }
  54.             if (counter < 7 && up && down == false)
  55.             {
  56.                 counter += 2;
  57.                
  58.             }
  59.  
  60.             else if (down)
  61.             {
  62.                 counter -= 2;
  63.                 if (counter == 1)
  64.                 {
  65.                     down = false;
  66.                     up = true;
  67.                     restart = true;
  68.                 }
  69.             }
  70.            
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement