Guest User

Untitled

a guest
May 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. package SeaBattle;
  2.  
  3. public class Drawing {
  4. private Player[] players;
  5.  
  6. public Drawing(Player[] players) {
  7. this.players = players;
  8. }
  9.  
  10. public Drawing() {
  11.  
  12. }
  13.  
  14. public void showSeaPlayers() {
  15. Sea tempSea;
  16. Point tempPoint;
  17.  
  18. for (Player player : players) {
  19. for (char charCount = 'A'; charCount <= 'J'; charCount++) {
  20. System.out.print("\t" + charCount);
  21. }
  22. System.out.println();
  23. tempSea = player.getSea();
  24. tempPoint = new Point();
  25.  
  26. for (int j = 0; j < tempSea.getSize(); j++) {
  27. System.out.print((j + 1) + "\t"); // Отрисовываем поля
  28. for (int k = 0; k < tempSea.getSize(); k++) {
  29. tempPoint.setX(k);
  30. tempPoint.setY(j);
  31. if (tempSea.getShipOnFields(tempPoint) == null) {
  32. System.out.print("_\t");
  33. } else {
  34.  
  35. if (!player.getSea().getShipOnFields(tempPoint).isPointShipOnCells(tempPoint)) {
  36. System.out.print("X\t");
  37. } else {
  38. System.out.print("O\t");
  39. }
  40. }
  41. }
  42. System.out.println();
  43. }
  44. System.out.println("\n");
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment