striking

Magic Wand

Jan 26th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. using System;
  2. class MagicWand
  3. {
  4. static void Main()
  5. {
  6. int n = int.Parse(Console.ReadLine());
  7. int width = 3 * n + 2;
  8. int countDotsMinus = 3;
  9. int dotsInCenter = 0;
  10.  
  11. //Console.WriteLine("First Part");
  12. Console.Write(new string('.', (width - 1) / 2));
  13. Console.Write("*");
  14. Console.WriteLine(new string('.', (width - 1) / 2));
  15.  
  16. //Console.WriteLine("Second Part");
  17. for (int i = 0; i <= n - 3; i++)
  18. {
  19. Console.Write(new string('.', (width - countDotsMinus) / 2));
  20. Console.Write("*");
  21. Console.Write(new string('.', 1 + dotsInCenter));
  22. Console.Write("*");
  23. Console.WriteLine(new string('.', (width - countDotsMinus) / 2));
  24.  
  25. if (((width - countDotsMinus) / 2) == n)
  26. {
  27. i = n;
  28. }
  29.  
  30. countDotsMinus += 2;
  31. dotsInCenter += 2;
  32. }
  33.  
  34. //Console.WriteLine("Third Part");
  35. Console.Write(new string('*', n));
  36. Console.Write(new string('.', width - (2*n)));
  37. Console.WriteLine(new string('*', n));
  38.  
  39. //Console.WriteLine("Fourt Part");
  40. int dotsInBeginning = 1;
  41.  
  42. for (int i = 0; i < (n - 1) / 2; i++)
  43. {
  44. Console.Write(new string('.', dotsInBeginning));
  45. Console.Write("*");
  46. Console.Write(new string('.', width - ((dotsInBeginning * 2) + 2)));
  47. Console.Write("*");
  48. Console.WriteLine(new string('.', dotsInBeginning));
  49. dotsInBeginning++;
  50. }
  51.  
  52. //Console.WriteLine("Fifth Part");
  53. int dotBeginningLast = (((width - (n + 6)) / 2) - 1) / 2;
  54. int count = 0;
  55.  
  56. for (int i = 1; i <= dotBeginningLast + 1; i++)
  57. {
  58. Console.Write(new string('.', dotBeginningLast - count));
  59. Console.Write("*");
  60. Console.Write(new string('.', dotBeginningLast + 1));
  61. Console.Write("*");
  62. Console.Write(new string('.', count));
  63. Console.Write("*");
  64. Console.Write(new string('.', n));
  65. Console.Write("*");
  66. Console.Write(new string('.', count));
  67. Console.Write("*");
  68. Console.Write(new string('.', dotBeginningLast + 1));
  69. Console.Write("*");
  70. Console.WriteLine(new string('.', dotBeginningLast - count));
  71.  
  72. count++;
  73. }
  74.  
  75. //Console.WriteLine("Sixth Part");
  76. Console.Write(new string('*', (((((width - (n + 2)) / 2)) - 1) / 2) + 1));
  77. Console.Write(new string('.', (((((width - (n + 2)) / 2)) - 1) / 2)));
  78. Console.Write("*");
  79. Console.Write(new string('.', n));
  80. Console.Write("*");
  81. Console.Write(new string('.', (((((width - (n + 2)) / 2)) - 1) / 2)));
  82. Console.WriteLine(new string('*', (((((width - (n + 2)) / 2)) - 1) / 2) + 1));
  83.  
  84. //Console.WriteLine("Seventh Part");
  85. for (int i = 0; i < n; i++)
  86. {
  87. Console.Write(new string ('.', n));
  88. Console.Write("*");
  89. Console.Write(new string('.', n));
  90. Console.Write("*");
  91. Console.WriteLine(new string('.', n));
  92. }
  93.  
  94. //Console.WriteLine("Eight Part");
  95. Console.Write(new string ('.', n));
  96. Console.Write(new string('*', n + 2));
  97. Console.WriteLine(new string('.', n));
  98. }
  99. }
Add Comment
Please, Sign In to add comment