Advertisement
Guest User

юзер для компа

a guest
May 27th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. flag=0;
  2. while (flag==0)
  3. {
  4. flag=1;
  5. printf("Vvedite koordinaty, po kotorym vy hotite nanesti udar\n");
  6. scanf("%d",&i);
  7. if (i>10 || i<1)
  8. {
  9. printf ("Oshibka vvoda\n");
  10. flag=0;
  11. }
  12. if (flag==1)
  13. {
  14. scanf("%d",&j);
  15. if (j>10 || j<1)
  16. {
  17. printf ("Oshibka vvoda\n");
  18. flag=0;
  19. }
  20. }
  21. if (flag==1)
  22. {
  23. i--; j--;
  24. if ((a[i][j]==1)||(a[i][j]==3))
  25. {
  26. printf("\nVy uzhe streljali po jetoj koordinate\n");
  27. move=1;
  28. }
  29. if (a[i][j]==0)
  30. {
  31. a[i][j]=1;
  32. move=0;
  33. }
  34. int nx,ny,kx,ky;
  35. if (a[i][j]==2)
  36. {
  37. a[i][j]=3;
  38. move=1;
  39. if (killed(i,j,b)==1)
  40. {
  41. userk++;
  42. nx=kx=j;
  43. ny=ky=i;
  44. if (a[i-1][j]==3)
  45. {
  46. if (a[i-2][j]==3)
  47. {
  48. if (a[i-3][j]==3)
  49. ny=i-3;
  50. }
  51. else ny=i-2;
  52. }
  53. else ny=i-1;
  54.  
  55. if (a[i+1][j]==3)
  56. {
  57. if (a[i+2][j]==3)
  58. {
  59. if (a[i+3][j]==3)
  60. ny=i-3;
  61. }
  62. else ny=i+2;
  63. }
  64. else ny=i+1;
  65.  
  66. if (a[i][j-1]==3)
  67. {
  68. if (a[i][j-2]==3)
  69. {
  70. if (a[i][j-3]==3)
  71. nx=j-3;
  72. }
  73. else nx=j-2;
  74. }
  75. else nx=j-1;
  76.  
  77. if (a[i][j+1]==3)
  78. {
  79. if (a[i][j+2]==3)
  80. {
  81. if (a[i][j+3]==3)
  82. nx=j+3;
  83. }
  84. else nx=j+2;
  85. }
  86. else nx=j+1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement