private int checkState() {
        int win = -1;

        if (checkDiagonal(0)) {
            win = board[0][0];
        } else if (checkDiagonal(2)) {
            win = board[0][2];
        }

        //проверка остальных линий
        if (win == -1)
            for (int i = 0; i < board.length; i++) {
                if (checkHorizontalLine(i)) {
                    win = board[i][0];
                    break;
                }
                if (checkVerticalLine(i)) {
                    win = board[0][i];
                    break;
                }
            }
        if (win == -1 && emptyField == 0)
            win = DEADHEAD;
        return win;
    }