BorisSimeonov

Programmers DNA

Nov 7th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2.  
  3. class ProgrammersDNA
  4. {
  5.     static void Main()
  6.     {
  7.         //65-71
  8.         int n = int.Parse(Console.ReadLine());
  9.         char ch = char.Parse(Console.ReadLine());
  10.         int pointer = 3;
  11.         string direction = "out";
  12.         //Visualization loop
  13.         for (int row = 1; row <= n; row++ )
  14.         {
  15.             for (int col = 1; col <= 7; col++ )
  16.             {
  17.                 if (col > pointer && col <= 7 - pointer)
  18.                 {
  19.                     if (ch > (char)71)
  20.                     {
  21.                         ch = (char)65;
  22.                     }
  23.                     Console.Write(ch);
  24.                     ch++;
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.Write(".");
  29.                 }
  30.             }
  31.             Console.WriteLine();
  32.             //Direction Changers
  33.             if (pointer == 0)
  34.             {
  35.                 direction = "in";
  36.             }
  37.             if (pointer == 3 && row % 7 < 1 && row != 1)
  38.             {
  39.                 continue;
  40.             }
  41.             if(pointer == 3)
  42.             {
  43.                 direction = "out";
  44.             }
  45.             //Drivers
  46.             if (direction == "out")
  47.             {
  48.                 pointer--;
  49.             }
  50.             if (direction == "in")
  51.             {
  52.                 pointer++;
  53.             }
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment