Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SeaBattle;
- public class Drawing {
- private Player[] players;
- public Drawing(Player[] players) {
- this.players = players;
- }
- public Drawing() {
- }
- public void showSeaPlayers() {
- Sea tempSea;
- Point tempPoint;
- for (Player player : players) {
- for (char charCount = 'A'; charCount <= 'J'; charCount++) {
- System.out.print("\t" + charCount);
- }
- System.out.println();
- tempSea = player.getSea();
- tempPoint = new Point();
- for (int j = 0; j < tempSea.getSize(); j++) {
- System.out.print((j + 1) + "\t"); // Отрисовываем поля
- for (int k = 0; k < tempSea.getSize(); k++) {
- tempPoint.setX(k);
- tempPoint.setY(j);
- if (tempSea.getShipOnFields(tempPoint) == null) {
- System.out.print("_\t");
- } else {
- if (!player.getSea().getShipOnFields(tempPoint).isPointShipOnCells(tempPoint)) {
- System.out.print("X\t");
- } else {
- System.out.print("O\t");
- }
- }
- }
- System.out.println();
- }
- System.out.println("\n");
- }
- }
- }
Add Comment
Please, Sign In to add comment