Guest User

Untitled

a guest
Feb 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. int RandomIndex = Random.Range(0,2);
  2.  
  3. List<int> teams = new List<int>();
  4.  
  5. int RandomIndex = Random.Range(0,2);
  6. if(RandomIndex == 0) {
  7. teams.Add(RandomIndex);
  8. if (teams.Count == 3){
  9. Debug.Log("Последовательность 3-х чисел 0 найдена!");
  10. teams.Clear();
  11. }
  12. }
  13.  
  14. class Class1
  15. {
  16. public static void Qwe()
  17. {
  18. Random random = new Random();
  19. int cur = 0;
  20. int count = 0;
  21. for (int i = 0; i < 20; i++)
  22. {
  23. int t = random.Next(0, 2);
  24.  
  25. if (t == cur) count++;
  26. else
  27. {
  28. cur = t;
  29. count = 1;
  30. }
  31.  
  32. if (count == 3)
  33. {
  34. Console.WriteLine($"последовательность из 3-х {t} найдена!");
  35. count = 0;
  36. }
  37. }
  38.  
  39. }
  40. }
  41.  
  42. if (count >= 3)
  43. {
  44. Console.WriteLine($"последовательность из 3-х {t} найдена!");
  45. }
Add Comment
Please, Sign In to add comment