Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.34 KB | None | 0 0
  1. class RastgeleSayi//Рандомное числа
  2. {
  3. public static int SayiUret(int min, int max)
  4. {
  5. if (rastgele == null)
  6. rastgele = new Random();
  7.  
  8. return rastgele.Next(min, max);
  9. }
  10.  
  11. private static Random rastgele;
  12. }
  13. class KarakterSeti // сдесь символы для постройки квадрата
  14. {
  15. public static char SolUstKose = '╔';
  16. public static char SagUstKose = '╗';
  17. public static char Duz = '═';
  18. public static char Dikey = '║';
  19. public static char SolAltKose = '╚';
  20. public static char SagAltKose = '╝';
  21. }
  22. class Dortgen
  23. {
  24. public Dortgen() // здесь зодается высота и ширина рандомными числами, цвет так же и кординаты так же рандомно
  25. {
  26. this.genislik = RastgeleSayi.SayiUret(2, 20);
  27. this.yukseklik = RastgeleSayi.SayiUret(2, 10);
  28. renk = (ConsoleColor)RastgeleSayi.SayiUret(1, 15);
  29. x = RastgeleSayi.SayiUret(1, 79);
  30. y = RastgeleSayi.SayiUret(1, 79);
  31. }
  32.  
  33.  
  34. public Dortgen(int xSinir, int ySinir)
  35. {
  36.  
  37. }
  38. public void ciz() // тут все собирается
  39. {
  40. ConsoleColor ilkrenk = Console.ForegroundColor;
  41. TepeCiz();
  42. DikeyCiz();
  43. TabanCiz();
  44. }
  45.  
  46.  
  47. public void DikeyCiz()//сдесь вертикальные столбци
  48. {
  49. ConsoleColor ilkrenk = Console.ForegroundColor;
  50. for (int i = 1; i < yukseklik; i++)
  51. {
  52. Console.SetCursorPosition(x, y + i);
  53. Console.Write(KarakterSeti.Dikey);
  54.  
  55. Console.SetCursorPosition(x + genislik + 1, y + i);
  56. Console.Write(KarakterSeti.Dikey);
  57. }
  58. Console.ForegroundColor = ilkrenk;
  59. }
  60. public void TepeCiz()//сдесь нижняя часть квадрата
  61. {
  62.  
  63. Console.ForegroundColor = renk;
  64.  
  65. Console.SetCursorPosition(x, y);
  66.  
  67. Console.Write(KarakterSeti.SolUstKose);
  68. for (int i = 0; i < genislik; i++)
  69. Console.Write(KarakterSeti.Duz);
  70. Console.Write(KarakterSeti.SagUstKose);
  71.  
  72.  
  73. }
  74. public void TabanCiz()//здесь верхняя часть
  75. {
  76. Console.SetCursorPosition(x, y + yukseklik);
  77. Console.Write(KarakterSeti.SolAltKose);
  78. for (int i = 0; i < genislik; i++)
  79. Console.Write(KarakterSeti.Duz);
  80. Console.Write(KarakterSeti.SagAltKose);
  81. }
  82.  
  83. public void SolaOtele()//сдесь я попытался сделать что бы двигалось в право и влево и вниз верх
  84. {
  85. x -= 1;
  86. }
  87. public void SagaOtele()
  88. {
  89. x += 1;
  90. }
  91. public void YukariOtele()
  92. {
  93. y -= 1;
  94. }
  95. public void AsagiOtele()
  96. {
  97. y += 1;
  98. }
  99.  
  100. public void boyutAta(int genislik, int yukseklik)
  101. {
  102. this.genislik = genislik;
  103. this.yukseklik = yukseklik;
  104. }
  105. public void RenkAta(ConsoleColor renk)
  106. {
  107. this.renk = renk;
  108. }
  109.  
  110.  
  111. private int genislik;
  112. private int yukseklik;
  113. private ConsoleColor renk;
  114. private int x;
  115. private int y;
  116.  
  117.  
  118. }
  119. class Program
  120. {
  121. static void Main(string[] args)
  122. {
  123. Dortgen dkg = new Dortgen();
  124. while (true)
  125. {
  126. Console.Clear();
  127. dkg.ciz();
  128. Thread.Sleep(300);
  129.  
  130. }
  131.  
  132.  
  133.  
  134. Console.ReadKey();
  135. }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement