Advertisement
Dicere

Untitled

Apr 22nd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. namespace WindowsFormsApp13
  2. {
  3. public class Движ : Form1
  4. {
  5. public Движ()
  6. {
  7. Random rnd = new Random();
  8. int caseSwitch = 0;
  9. switch (caseSwitch = rnd.Next(0, 3))
  10. {
  11. //Вправо
  12. case 0:
  13. if (o != 10)
  14. {
  15. p += 1;
  16. n += 0;
  17.  
  18. }
  19.  
  20. break;
  21. //Вниз
  22. case 1:
  23. p += 0;
  24. n += 1;
  25. break;
  26. //Вверх
  27. case 2:
  28.  
  29. p += 0;
  30. n -= 1;
  31. break;
  32. //Влево
  33. case 3:
  34. p -= 1;
  35. n += 0;
  36. break;
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement