igorich1376

Logika_работа с цветом

May 20th, 2025
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 3.56 KB | None | 0 0
  1. ## uses crt; // работа с цветом
  2.  
  3. var (b,r,g,y,m,c) := (' BB',' RR',' GG',' YY',' MM',' CC');
  4. //
  5. var auto_lst := new List<string>;
  6. auto_lst.Add(b);
  7. auto_lst.Add(r);
  8. auto_lst.Add(g);
  9. auto_lst.Add(y);
  10. auto_lst.Add(m);
  11. auto_lst.Add(c);
  12. auto_lst := auto_lst.Shuffle;
  13. auto_lst.RemoveAt(0);auto_lst.RemoveAt(0);
  14. //
  15. Println(auto_lst);
  16. Println('Вариант компьютера: ');
  17. // индекс 0
  18. if (auto_lst[0] = b)
  19. then
  20.   begin
  21.     TextBackground(crt.LightBlue);
  22.     TextColor(crt.Black);
  23.     Print(' BB');
  24.   end
  25. else if (auto_lst[0] = r)
  26. then
  27.   begin
  28.     TextBackground(crt.LightRed);
  29.     TextColor(crt.Black);
  30.     Print(' RR');
  31.   end
  32.  else if (auto_lst[0] = g)
  33. then
  34.   begin
  35.     TextBackground(crt.LightGreen);
  36.     TextColor(crt.Black);
  37.     Print(' GG');
  38.   end
  39. else if (auto_lst[0] = y)
  40. then
  41.   begin
  42.     TextBackground(crt.Yellow);
  43.     TextColor(crt.Black);
  44.     Print(' YY');
  45.   end
  46. else if (auto_lst[0] = m)
  47. then
  48.   begin
  49.     TextBackground(crt.LightMagenta);
  50.     TextColor(crt.Black);
  51.     Print(' MM');
  52.   end
  53. else if (auto_lst[0] = c)
  54. then
  55.   begin
  56.     TextBackground(crt.LightCyan);
  57.     TextColor(crt.Black);
  58.     Print(' CC');
  59.   end;
  60. // индекс 1
  61. if (auto_lst[1] = b)
  62. then
  63.   begin
  64.     TextBackground(crt.LightBlue);
  65.     TextColor(crt.Black);
  66.     Print(' BB');
  67.   end
  68. else if (auto_lst[1] = r)
  69. then
  70.   begin
  71.     TextBackground(crt.LightRed);
  72.     TextColor(crt.Black);
  73.     Print(' RR');
  74.   end
  75.  else if (auto_lst[1] = g)
  76. then
  77.   begin
  78.     TextBackground(crt.LightGreen);
  79.     TextColor(crt.Black);
  80.     Print(' GG');
  81.   end
  82. else if (auto_lst[1] = y)
  83. then
  84.   begin
  85.     TextBackground(crt.Yellow);
  86.     TextColor(crt.Black);
  87.     Print(' YY');
  88.   end
  89. else if (auto_lst[1] = m)
  90. then
  91.   begin
  92.     TextBackground(crt.LightMagenta);
  93.     TextColor(crt.Black);
  94.     Print(' MM');
  95.   end
  96. else if (auto_lst[1] = c)
  97. then
  98.   begin
  99.     TextBackground(crt.LightCyan);
  100.     TextColor(crt.Black);
  101.     Print(' CC');
  102.   end;
  103. // индекс 2
  104. if (auto_lst[2] = b)
  105. then
  106.   begin
  107.     TextBackground(crt.LightBlue);
  108.     TextColor(crt.Black);
  109.     Print(' BB');
  110.   end
  111. else if (auto_lst[2] = r)
  112. then
  113.   begin
  114.     TextBackground(crt.LightRed);
  115.     TextColor(crt.Black);
  116.     Print(' RR');
  117.   end
  118.  else if (auto_lst[2] = g)
  119. then
  120.   begin
  121.     TextBackground(crt.LightGreen);
  122.     TextColor(crt.Black);
  123.     Print(' GG');
  124.   end
  125. else if (auto_lst[2] = y)
  126. then
  127.   begin
  128.     TextBackground(crt.Yellow);
  129.     TextColor(crt.Black);
  130.     Print(' YY');
  131.   end
  132. else if (auto_lst[2] = m)
  133. then
  134.   begin
  135.     TextBackground(crt.LightMagenta);
  136.     TextColor(crt.Black);
  137.     Print(' MM');
  138.   end
  139. else if (auto_lst[2] = c)
  140. then
  141.   begin
  142.     TextBackground(crt.LightCyan);
  143.     TextColor(crt.Black);
  144.     Print(' CC');
  145.   end;
  146. // индекс 3
  147. if (auto_lst[3] = b)
  148. then
  149.   begin
  150.     TextBackground(crt.LightBlue);
  151.     TextColor(crt.Black);
  152.     Print(' BB');
  153.   end
  154. else if (auto_lst[3] = r)
  155. then
  156.   begin
  157.     TextBackground(crt.LightRed);
  158.     TextColor(crt.Black);
  159.     Print(' RR');
  160.   end
  161.  else if (auto_lst[3] = g)
  162. then
  163.   begin
  164.     TextBackground(crt.LightGreen);
  165.     TextColor(crt.Black);
  166.     Print(' GG');
  167.   end
  168. else if (auto_lst[3] = y)
  169. then
  170.   begin
  171.     TextBackground(crt.Yellow);
  172.     TextColor(crt.Black);
  173.     Print(' YY');
  174.   end
  175. else if (auto_lst[3] = m)
  176. then
  177.   begin
  178.     TextBackground(crt.LightMagenta);
  179.     TextColor(crt.Black);
  180.     Print(' MM');
  181.   end
  182. else if (auto_lst[3] = c)
  183. then
  184.   begin
  185.     TextBackground(crt.LightCyan);
  186.     TextColor(crt.Black);
  187.     Print(' CC');
  188.   end;
  189.  
  190. readln()
Advertisement
Add Comment
Please, Sign In to add comment