Sanady

Untitled

Mar 13th, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. int main()
  2. {
  3. int row = -1, col = -1;
  4. int playerID = 1;
  5.  
  6. printf("Hracie pole pred strelou:\n\n");
  7. drawAttackGrid();
  8.  
  9. while(1)
  10. {
  11. printf("\tHrac %i: ", playerID);
  12. scanf("%i %i", &row, &col);
  13. if(checkHit(row, col, playerID))
  14. {
  15. CLEAR_SCREEN();
  16. attack_grid[row][col] = playerID;
  17. drawAttackGrid();
  18. printf("\n\nHrac %i zasiahol lod na suradnici (%i, %i)\n\n", playerID, row, col);
  19. }
  20. else
  21. {
  22. CLEAR_SCREEN();
  23. attack_grid[row][col] = 3;
  24. drawAttackGrid();
  25. printf("\n\nHrac %i zasiahol vodu\n\n", playerID);
  26. }
  27.  
  28. if(playerID == 1)
  29. {
  30. playerID = 2;
  31. }
  32. else if(playerID == 2)
  33. {
  34. playerID = 1;
  35. }
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment