Datasets:

ArXiv:
License:
File size: 1,657 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//Csaba
package battleship.gui.Game;

import battleship.Logic.Board;
import battleship.Logic.CellStatus;
import java.awt.Color;
import javax.swing.JPanel;

/**
 *
 * @author Csaba
 */
public class BoardGUI extends JPanel {

    protected Board board;
    protected CellGUI[][] cells;

    public BoardGUI(Board board) {
        setLayout(null);
        this.board = board;
        int widtheight = 300;
        this.setSize(widtheight, widtheight);
        this.setBackground(Color.GRAY);
    }

    public Board getBoard() {
        return this.board;
    }

    public void Hit(int i, int j) {
        switch (cells[i][j].getStatus()) {
            case Empty:
                cells[i][j].setCell(CellStatus.EmptyHit);
                break;
            case EmptyHit:
                break;
            case NearShip:
                break;
            case Ship:
                cells[i][j].setCell(CellStatus.ShipHit);
                break;
            case ShipHit:
                break;
            case ShipSunk:
                break;
            default:
                break;
        }
    }

    public void Hit(int i, int j, CellStatus status) {
        switch (status) {
            case Empty:
                cells[i][j].setCell(CellStatus.EmptyHit);
                break;
            case EmptyHit:
                break;
            case NearShip:
                break;
            case Ship:
                cells[i][j].setCell(CellStatus.ShipHit);
                break;
            case ShipHit:
                break;
            case ShipSunk:
                break;
            default:
                break;
        }
    }
}