void attack() {
        for (int p = 10; p > 0; p -= 5) {
            for (int i = 0; i < 8; i++) {
                int sum = 0;
                for (int j : ways[i]) {
                    sum += j;
                }
                if (sum == p) {
                    if (i < 3) {
                        for (int j = 0; j < 3; j++) {
                            if (ar[i][j] == 0) {
                                mark(ar, i, j);
                                return;
                            }
                        }
                    } else if (i < 6) {
                        for (int j = 0; j < 3; j++) {
                            if (ar[j][i - 3] == 0) {
                                mark(ar, j, i - 3);
                                return;
                            }
                        }
                    } else if (i == 6) {
                        for (int j = 0; j < 3; j++) {
                            if (ar[j][j] == 0) {
                                mark(ar, j, j);
                                return;
                            }
                        }

                    } else {
                        for (int j = 0, k = 2; j < 3 && k >= 0; j++, k--) {

                            if (ar[j][k] == 0) {
                                mark(ar, j, k);
                                return;
                            }

                        }
                    }
                }
            }
        }

        int min = 25, minidx = 0;
        for (int j = 0; j < 8; j++) {
            int cursum = 0;

            for (int k : ways[j]) {
                cursum += j;
            }
            if (cursum < min) {
                min = cursum;
                minidx = j;
            }
        }
        if (minidx < 3) {
            for (int j = 0; j < 3; j++) {
                if (ar[minidx][j] == 0) {
                    mark(ar, minidx, j);
                    return;
                }
            }
        } else if (minidx < 6) {
            for (int j = 0; j < 3; j++) {
                if (ar[j][minidx - 3] == 0) {
                    mark(ar, j, minidx - 3);
                    return;
                }
            }
        } else if (minidx == 6) {
            for (int j = 0; j < 3; j++) {
                if (ar[j][j] == 0) {
                    mark(ar, j, j);
                    return;
                }
            }

        } else {
            for (int j = 0, k = 2; j < 3 && k >= 0; j++, k--) {

                if (ar[j][k] == 0) {
                    mark(ar, j, k);
                    return;
                }

            }
        }
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (ar[i][j] == 0) {
                    mark(ar, i, j);
                }
            }
        }

    }