Проблема Игра "Морской Бой"

N

Novy

Такое дельце: нужно быстро дописать игру. Проблема в том, что нечто просто заменяет все клетки кораблей на клетку воды перед выводом массивов на экран и в результате игра не работает. Пожалуйста, скажите мне, в чём тут ошибка? И ещё кое-что: как мне сделать так, что-бы клетки кораблей ставились вместе и никак не смогли поставиться отдельно друг от друга? Мне сегодня эту игру нужно сдать, как курсовую работу, так что просьба помочь как можно скорее, иначе меня выгонят из Академии, чего я очень не хочу. Проблема где-то либо в Set_ships либо при выводе массивов. Вот сам код:
C++:
#include<iostream>
#include<ctime>
#include<iomanip>
#include<string>
#include<Windows.h>
#include<windows.h>
using namespace std;

HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);

char type_of_ship[100];
int plant_choise_x, plant_choise_y;
bool cell_is_checked = false;
int torp_checked = 0, destr_checked = 0, crui_checked = 0, bs_checked = 0;

const int FIELD_SIZE = 10;
char PlayerArr[FIELD_SIZE][FIELD_SIZE];
char BotArr[FIELD_SIZE][FIELD_SIZE];

char Player_Name[100];
char Bot_Name[100];

int amount_of_ship_cells_left_to_drown_P1;
int amount_of_ship_cells_left_to_drown_P2;

// [x][y], где x - вертикаль, y - горизонталь

char PlayerWater = '~';
char BotWater = '~';
char PlayerTorpede = 'Т';
char BotTorpede = 'Т';
char PlayerDestroyer = 'Э';
char BotDestroyer = 'Э';
char PlayerCruiser = 'К';
char BotCruiser = 'К';
char PlayerBattleship = 'Л';
char BotBattleship = 'Л';
char PlayerShipHit = 'Х';
char BotShipHit = 'X';
char PlayerMiss = '*';
char BotMiss = '*';

void ifPlayerWin(char* p1) {
    system("cls");
    cout << "Игрок " << Player_Name << " победил " << Bot_Name << "! Вау! Какая игра... ";
    cout << "\n Спасибо за игру!" << endl;

    system("pause");

    exit(1);
}

void ifBotWin(char* p2) {
    system("cls");
    cout << "Машина оказалась лучше в Морском Бою чем " << Player_Name << "! Какое разочарование... Бывает...";
    cout << "\n Повезёт в следующий раз! Спасибо за игру, " << Bot_Name << "!";
    system("pause");

    exit(1);
}

void Marker(char arr[][FIELD_SIZE], int x, int y)
{
    for (int i = 0; i < 4; i++)
    {
        if (arr[x][y + i] == PlayerShipHit) {
            arr[x][y + i] = PlayerMiss;
            arr[x + 1][y + i] = PlayerMiss;
            arr[x - 1][y + i] = PlayerMiss;
        }

        if (arr[x][y - i] == PlayerShipHit) {
            arr[x][y - i] = PlayerMiss;
            arr[x + 1][y - i] = PlayerMiss;
            arr[x - 1][y - i] = PlayerMiss;
        }

        if (arr[x + i][y] == PlayerShipHit) {
            arr[x + i][y] = PlayerMiss;
            arr[x + i][y + 1] = PlayerMiss;
            arr[x + i][y - 1] = PlayerMiss;
        }

        if (arr[x - i][y] == PlayerShipHit) {
            arr[x - i][y] = PlayerMiss;
            arr[x - i][y + 1] = PlayerMiss;
            arr[x - i][y - 1] = PlayerMiss;
        }
    }

    arr[x - 1][y - 1] = PlayerMiss;
    arr[x - 1][y + 1] = PlayerMiss;
    arr[x + 1][y + 1] = PlayerMiss;
    arr[x + 1][y - 1] = PlayerMiss;
}

bool Cell_checker(int PlayerNumber, int asked_cell) {

    char T;
    char D;
    char C;
    char BS;
    char water;

    switch (PlayerNumber)
    {
    case 1:
    {
        T = PlayerTorpede;
        D = PlayerDestroyer;
        C = PlayerCruiser;
        BS = PlayerBattleship;
        water = PlayerWater;
    } break;

    case 2:
    {
        T = BotTorpede;
        D = BotDestroyer;
        C = BotCruiser;
        BS = BotBattleship;
        water = BotWater;
    } break;

    }

    if ((asked_cell == T || asked_cell == D || asked_cell == C || asked_cell == BS) && asked_cell != water)
        return true;
    else
        return false;
}

void Finisher(char arr[FIELD_SIZE][FIELD_SIZE], int x, int y) {

    for (int i = 0; ; i++)
    {
        if (Cell_checker(1, arr[x + i][y]) == true /* низ */)
            arr[x + i][y] = PlayerShipHit;

        if (Cell_checker(1, arr[x - i][y]) == true /* верх */)
            arr[x - i][y] = PlayerShipHit;

        if (Cell_checker(1, arr[x][y + i]) == true /* право */)
            arr[x][y + i] = PlayerShipHit;

        if (Cell_checker(1, arr[x][y - i]) == true /* лево */)
            arr[x][y - i] = PlayerShipHit;

        if (Cell_checker(1, arr[x + 1][y - 1]) == true /* нижнее лево */)
            arr[x + 1][y - 1] = PlayerShipHit;

        if (Cell_checker(1, arr[x + 1][y + 1]) == true /* нижнее право */)
            arr[x + 1][y + 1] = PlayerShipHit;

        if (Cell_checker(1, arr[x - 1][y - 1]) == true /* верхнее лево */)
            arr[x - 1][y - 1] = PlayerShipHit;

        if (Cell_checker(1, arr[x - 1][y + 1]) == true /* верхнее право */)
            arr[x - 1][y + 1] = PlayerShipHit;

        else {
            Marker(PlayerArr, plant_choise_x, plant_choise_y);
            break;
        }
    }
}

void Print_table(char arr[][FIELD_SIZE]) {

    for (int i = 0; i < FIELD_SIZE + 1; i++)
    {
        cout << "_ ";
    }

    cout << endl << "_|";
    for (int i = 0; i < FIELD_SIZE; i++)
    {
        cout << i << "|"; // верхний ряд
    }
    cout << endl;
    char arr_coord_x[10]{ '0','1','2','3','4','5','6','7','8','9' };

    for (int i = 0; i < FIELD_SIZE; i++)
    {
        cout << arr_coord_x[i] << "|"; // боковой левый ряд

        for (int j = 0; j < FIELD_SIZE; j++)
        {
            SetConsoleTextAttribute(h, 1);
            cout << arr[i][j];
            SetConsoleTextAttribute(h, 7);
            cout << "|";
        }
        cout << endl;
    }
}

void Players_names(char* Player, char* Bot) {

    cout << "Введите Ваш никнейм : ";
    cin >> Player;

    cout << "Введите никнейм соперника (бота) : ";
    cin >> Bot;

}

void Create_table(char arr[][FIELD_SIZE], char c) {
    for (int i = 0; i < FIELD_SIZE; i++)
    {
        for (int j = 0; j < FIELD_SIZE; j++)
        {
            arr[i][j] = c;
        }
    }

}

void put_battleship(char arr[FIELD_SIZE][FIELD_SIZE], int &bs_checked, int PlayerNumber, int plant_choise_x, int plant_choise_y, bool cell_is_checked) {

    char BS;

    switch (PlayerNumber)
    {
    case 1:
    {
        BS = PlayerBattleship;

        if ((Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /* нижняя */
            && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false /* верхняя */
            && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false /* левая */
            && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false /* правая */)
            ||

            /// [1][2][3][4]

            (
                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x][plant_choise_y + 1] == BS
                && arr[plant_choise_x][plant_choise_y + 2] == BS
                && arr[plant_choise_x][plant_choise_y + 3] == BS

                // [1]
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /* нижняя */
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false /* верхняя */
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false /* левая */
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false /* верхнелевая */
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false /* нижнелевая */


                                                                                                    // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false /* нижняя */
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false /* верхняя */

                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 2]) == false /* нижняя */
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 2]) == false /* верхняя */

                                                                                                    // [4]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 3]) == false /* нижняя */
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 3]) == false /* верхняя */
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 4] == false) /* правая */
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 4]) == false /* верхнеправая */
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 4]) == false /* нижнеправая */
                )
            ||

            /// [4][3][2][1]

            (
                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x][plant_choise_y - 1] == BS
                && arr[plant_choise_x][plant_choise_y - 2] == BS
                && arr[plant_choise_x][plant_choise_y - 3] == BS

                // [1]

                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхнеправая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижнеправая

                                                                                                    // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижняя


                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 2]) == false // нижняя


                                                                                                    // [4]

                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 4]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 3]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 3]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 4]) == false // нижнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 4]) == false // верхнелевая
                )

            ||

            /// [2][*1][3][4]

            (
                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x][plant_choise_y - 1] == BS
                && arr[plant_choise_x][plant_choise_y + 1] == BS
                && arr[plant_choise_x][plant_choise_y + 2] == BS

                // [1]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя

                                                                                                // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 2]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 2]) == false // нижнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхнелевая

                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижняя

                                                                                                    // [4]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 2]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 2]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 3]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 2]) == false // нижнеправая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхнеправая







                )

            ||

            // [][][*][]

            (true)

            ||

            /*
            [1]
            [2]
            [3]
            [4]
            */

            (true)

            ||

            /*
            [4]
            [3]
            [2]
            [1]
            */

            (true)

            ||

            /*
            [ ]
            [ ]
            [*]
            [ ]
            */

            (true)

            ||

            /*
            [ ]
            [*]
            [ ]
            [ ]
            */

            (true)

            )
        {
            arr[plant_choise_x][plant_choise_y] = BS;
            cell_is_checked = true;
        }

        if (cell_is_checked == true) {
            bs_checked++;
            cell_is_checked = false;
        }


    } break;

    case 2:
    {
        BS = BotBattleship;




















    } break;

    }
















    if (cell_is_checked == true) {
        bs_checked++;
        cell_is_checked = false;
    }
}

void put_cruiser(char arr[FIELD_SIZE][FIELD_SIZE], int &crui_checked, int PlayerNumber, int plant_choise_x, int plant_choise_y, bool cell_is_checked) {

    char C;

    switch (PlayerNumber)
    {
    case 1:
    {
        C = PlayerCruiser;
    } break;

    case 2:
    {
        C = BotCruiser;
    } break;

    }


    if (
        /// [1][2][3]

        //[1]
       
        (Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /* нижняя */
            && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false /* верхняя */
            && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false /* левая */
            && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false /* правая */)
            ||
            (arr[plant_choise_x][plant_choise_y + 1] == C && arr[plant_choise_x][plant_choise_y + 2] == C
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижелевая

                                                                                                    //[2]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижняя

                                                                                                    //[3]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 2]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 2]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 3]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 3]) == false // верхнеправая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 3]) == false // нижнеправая
                )
            ||

            /// [3][2][1]
            (
                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x][plant_choise_y - 1] == C && arr[plant_choise_x][plant_choise_y - 2] == C

                // [1]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхнеправая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижнеправая

                                                                                                    // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижняя

                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 2]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 3]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 3]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 3]) == false // нижнелевая
                )
            ||
            (
                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x][plant_choise_y - 1] == C && arr[plant_choise_x][plant_choise_y + 1] == C

                /// [2][1][3]
                // [1]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя

                                                                                                // [2]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 2]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 2]) == false // нижнелевая

                                                                                                    // [3]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 2]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 2]) == false // верхнеправая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 2]) == false // нижеправая
                )
            ||
            (
                /*
                [1]
                [2]
                [3]
                */

                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x + 1][plant_choise_y] == C && arr[plant_choise_x + 2][plant_choise_y] == C

                // [1]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхнеправая

                                                                                                    // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // правая

                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 3][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 3][plant_choise_y - 1]) == false // нижнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 3][plant_choise_y + 1]) == false // нижнеправая
                )
            ||
            (
                // [3]
                // [2]
                // [1]

                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x + 1][plant_choise_y] == C
                && arr[plant_choise_x + 2][plant_choise_y] == C

                // [1]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижнеправая

                                                                                                    // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // правая

                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 3][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 3][plant_choise_y - 1]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 3][plant_choise_y + 1]) == false // верхнеправая
                )
            ||
            (
                // [2]
                // [1]
                // [3]

                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false
                && arr[plant_choise_x + 1][plant_choise_y] == C
                && arr[plant_choise_x - 1][plant_choise_y] == C

                // [1]

                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая

                                                                                                // [2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y - 1]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y + 1]) == false // верхнеправая

                                                                                                    // [3]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y - 1]) == false // нижнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y + 1]) == false // нижнеправая
                )

               
    )
    {
        arr[plant_choise_x][plant_choise_y] = C;
        cell_is_checked = true;
    }

    if (cell_is_checked == true) {
        crui_checked++;
        cell_is_checked = false;
    }

}

void put_destroyer(char arr[FIELD_SIZE][FIELD_SIZE], int &destr_checked, int PlayerNumber, int plant_choise_x, int plant_choise_y, bool cell_is_checked) {

    char D;
    bool ship_building = false;

    switch (PlayerNumber)
    {
    case 1:
    {
        D = PlayerDestroyer;
    } break;

    case 2:
    {
        D = BotDestroyer;
    } break;

    }

    if (
        (
            Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y] == false)
            && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /* нижняя */
            && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false /* верхняя */
            && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false /* левая */
            && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false /* правая */)
        ||
        (
            arr[plant_choise_x + 1][plant_choise_y] == D
            && (Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false /// choise_cords (1)
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y - 1]) == false // [1]
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y + 1]) == false // [2]
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 2][plant_choise_y]) == false /// choise_cords (2)
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false
                )
            ||
            (arr[plant_choise_x - 1][plant_choise_y] == D                                    // [2]
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false // [1]
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /// choise_cords (1) // низ
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижнелевая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижнеправая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // лево
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // право

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y]) == false /// choise_cords (2) // верх
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y - 1]) == false // верхнелевая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 2][plant_choise_y + 1]) == false // верхнеправая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // правая
                )
            ||
            (
                arr[plant_choise_x][plant_choise_y + 1] == D                                // ---->
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false // [1][2]

                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /// choise_cords (1) // низ
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верх
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижнелевая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхнелевая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // лево

                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false /// choise_cords (2) // верх
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // низ
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 2]) == false // верхнеправая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 2]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 2]) == false // нижнеправая
                )
            ||
            (
                arr[plant_choise_x][plant_choise_y - 1] == D     // [1]                            // [2][1]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верх (1)
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // низ
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхнеправая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижнеправая кллетка

                                                                                                    // [2]
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхнелевая клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 2]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 2]) == false // верхнелевая
                )
            ||
            (
                Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false // сама клетка
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false // верхняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false // нижняя
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false // левая
                && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false // правая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1]) == false // верхнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1]) == false // верхнеправая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1]) == false // нижнелевая
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1]) == false // нижнеправая
                )
            )) {
        arr[plant_choise_x][plant_choise_y] = D;
        cell_is_checked = true;
        ship_building = true;
    }

    if (cell_is_checked == true) {
        destr_checked++;
        cell_is_checked = false;
    }
}

void put_torpede(char arr[FIELD_SIZE][FIELD_SIZE], int &torp_checked, int PlayerNumber, int plant_choise_x, int plant_choise_y, bool cell_is_checked) {

    char T;

    switch (PlayerNumber)
    {
    case 1:
    {
        T = PlayerTorpede;
    } break;

    case 2:
    {
        T = BotTorpede;
    } break;

    }

    if ( // торпедный катер
        Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y]) == false // сама клетка
        && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y]) == false /* нижняя */
        && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y]) == false /* верхняя */
        && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y - 1]) == false /* левая */
        && Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y + 1]) == false /* правая */
        ) {
        arr[plant_choise_x][plant_choise_y] = T;
        cell_is_checked = true;
    }

    if (cell_is_checked == true) {
        torp_checked++;
        cell_is_checked = false;
    }

}

void Set_ships(char arr[][FIELD_SIZE], int PlayerNumber) {

    char PNEnd[10];
    char T;
    char D;
    char C;
    char BS;

    if (PlayerNumber == 1) {
        T = PlayerTorpede;
        D = PlayerDestroyer;
        C = PlayerCruiser;
        BS = PlayerBattleship;
        arr = PlayerArr;

        strcpy_s(PNEnd, " (Вы)");

        while (bs_checked != 4)
        {
            system("cls");

            Print_table(arr);

            if (torp_checked != 4)
                strcpy_s(type_of_ship, "торпедный катер (1 клетка для размещения)");

            else if (torp_checked == 4)
                strcpy_s(type_of_ship, "эсминец (2 клетки для размещения)");

            else if (destr_checked == 6)
                strcpy_s(type_of_ship, "крейсер (3 клетки для размещения)");

            else if (crui_checked == 6)
                strcpy_s(type_of_ship, "линкор (4 клетки для размещения)");

            cout << "Введите порядковый номер клетки, на которую " << Player_Name << PNEnd << " хочет поместить кораблик (x,y).";
            cout << endl << "Помещается " << type_of_ship << "." << endl;
            cout << "   Ваши координаты: ";

            cin >> plant_choise_x >> plant_choise_y;

            if (Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y] /* само место, куда ставится клетка*/) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1] /* верхняя правая клетка */) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1] /* нижняя левая клетка */) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1] /* верхняя левая клетка */) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1] /* нижняя правая клетка */) == false
                && plant_choise_x <= FIELD_SIZE && plant_choise_y <= FIELD_SIZE)
            {

                if (torp_checked >= 0 && torp_checked < 4) {
                    put_torpede(arr, torp_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }

                if (torp_checked == 4 && destr_checked >= 0 && destr_checked < 6) {
                    put_destroyer(arr, destr_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }

                if (destr_checked == 6 && crui_checked >= 0 && crui_checked < 6) {
                    put_cruiser(arr, crui_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }

                if (crui_checked == 6 && bs_checked >= 0 && bs_checked < 4) {
                    put_battleship(arr, bs_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }
            }
        }
    }

    else if (PlayerNumber == 2) {
        T = BotTorpede;
        D = BotDestroyer;
        C = BotCruiser;
        BS = BotBattleship;
        arr = BotArr;

        while (bs_checked != 4) {
            plant_choise_x = rand() % 11;
            plant_choise_y = rand() % 11;

            if (Cell_checker(PlayerNumber, arr[plant_choise_x][plant_choise_y] /* само место, куда ставится клетка*/) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y + 1] /* верхняя правая клетка */) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y - 1] /* нижняя левая клетка */) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x - 1][plant_choise_y - 1] /* верхняя левая клетка */) == false
                && Cell_checker(PlayerNumber, arr[plant_choise_x + 1][plant_choise_y + 1] /* нижняя правая клетка */) == false
                && plant_choise_x <= FIELD_SIZE && plant_choise_y <= FIELD_SIZE)
            {

                if (torp_checked >= 0 && torp_checked < 4) {
                    put_torpede(arr, torp_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P2++;
                }

                if (torp_checked == 4 && destr_checked >= 0 && destr_checked < 6) {
                    put_destroyer(arr, destr_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P2++;
                }

                if (destr_checked == 6 && crui_checked >= 0 && crui_checked < 6) {
                    put_cruiser(arr, crui_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P2++;
                }

                if (crui_checked == 6 && bs_checked >= 0 && bs_checked < 4) {
                    put_battleship(arr, bs_checked, PlayerNumber, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P2++;
                }
            }
        }
    }

    else {

        T = PlayerTorpede;
        D = PlayerDestroyer;
        C = PlayerCruiser;
        BS = PlayerBattleship;
        arr = PlayerArr;

        while (bs_checked != 4) {
            system("cls");
            plant_choise_x = rand() % 11;
            plant_choise_y = rand() % 11;

            Print_table(PlayerArr);

            if (Cell_checker(1, arr[plant_choise_x][plant_choise_y] /* само место, куда ставится клетка*/) == false
                && Cell_checker(1, arr[plant_choise_x - 1][plant_choise_y + 1] /* верхняя правая клетка */) == false
                && Cell_checker(1, arr[plant_choise_x + 1][plant_choise_y - 1] /* нижняя левая клетка */) == false
                && Cell_checker(1, arr[plant_choise_x - 1][plant_choise_y - 1] /* верхняя левая клетка */) == false
                && Cell_checker(1, arr[plant_choise_x + 1][plant_choise_y + 1] /* нижняя правая клетка */) == false
                && plant_choise_x <= FIELD_SIZE && plant_choise_y <= FIELD_SIZE)
            {

                if (torp_checked >= 0 && torp_checked < 4) {
                    put_torpede(arr, torp_checked, 1, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }

                if (torp_checked == 4 && destr_checked >= 0 && destr_checked < 6) {
                    put_destroyer(arr, destr_checked, 1, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }

                if (destr_checked == 6 && crui_checked >= 0 && crui_checked < 6) {
                    put_cruiser(arr, crui_checked, 1, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }

                if (crui_checked == 6 && bs_checked >= 0 && bs_checked < 4) {
                    put_battleship(arr, bs_checked, 1, plant_choise_x, plant_choise_y, cell_is_checked);
                    amount_of_ship_cells_left_to_drown_P1++;
                }
            }

        }
    }
}

void Player_move(char PlayerArr[][FIELD_SIZE], char BotArr[][FIELD_SIZE], int PlayerNumber, char* p1, char* p2)
{

    while (true) {
        system("cls");
        plant_choise_x = 0; plant_choise_y = 0;

        if (PlayerNumber == 1) {

            Print_table(PlayerArr);

            cout << "\n Введите координаты клетки, в которую вы хотите стрельнуть, ";
            SetConsoleTextAttribute(h, 1);
            cout << p1;
            SetConsoleTextAttribute(h, 7);
            cout << ": ";
            cout << "\n Вам осталось потопить клеток кораблей противника: " << amount_of_ship_cells_left_to_drown_P2;
            cin >> BotArr[plant_choise_x][plant_choise_x];

            if ((BotArr[plant_choise_x][plant_choise_x] == BotTorpede
                || BotArr[plant_choise_x][plant_choise_x] == BotDestroyer
                || BotArr[plant_choise_x][plant_choise_x] == BotCruiser
                || BotArr[plant_choise_x][plant_choise_x] == BotBattleship)
                && BotArr[plant_choise_x][plant_choise_x] != BotShipHit
                && BotArr[plant_choise_x][plant_choise_y] != BotMiss)
            {
                BotArr[plant_choise_x][plant_choise_y] = BotShipHit;
                --amount_of_ship_cells_left_to_drown_P2;
                system("cls");
                cout << "Попадание!" << endl;
                system("pause");

                Finisher(PlayerArr, plant_choise_x, plant_choise_y);

                continue;
            }

            else if (BotArr[plant_choise_x][plant_choise_y] == BotShipHit
                || BotArr[plant_choise_x][plant_choise_y] == BotMiss) {
                continue;
            }

            else {
                BotArr[plant_choise_x][plant_choise_y] = BotMiss;
                break;
            }
        }

        else {
            Print_table(BotArr);

            plant_choise_x = rand() % FIELD_SIZE;
            plant_choise_y = rand() % FIELD_SIZE;

            if ((PlayerArr[plant_choise_x][plant_choise_y] == PlayerTorpede
                || PlayerArr[plant_choise_x][plant_choise_y] == PlayerDestroyer
                || PlayerArr[plant_choise_x][plant_choise_y] == PlayerCruiser
                || PlayerArr[plant_choise_x][plant_choise_y] == PlayerBattleship)
                && PlayerArr[plant_choise_x][plant_choise_y] != PlayerShipHit
                && PlayerArr[plant_choise_x][plant_choise_y] != PlayerMiss)
            {
                PlayerArr[plant_choise_x][plant_choise_y] = PlayerShipHit;
                Finisher(PlayerArr, plant_choise_x, plant_choise_y);
                --amount_of_ship_cells_left_to_drown_P1;
                continue;
            }

            else if (PlayerArr[plant_choise_x][plant_choise_y] == PlayerShipHit
                || PlayerArr[plant_choise_x][plant_choise_y] == PlayerMiss) {
                continue;
            }

            else {
                PlayerArr[plant_choise_x][plant_choise_y] = PlayerMiss;
                break;
            }
        }
    }
}

bool Win(int ship_cells) {

    if (ship_cells == 0)
        return true;
    return false;
}

int main()
{
    srand((unsigned)time(0));
    setlocale(LC_ALL, "Russian");

    char PlayerArr[FIELD_SIZE][FIELD_SIZE];
    char BotArr[FIELD_SIZE][FIELD_SIZE];

    Players_names(Player_Name, Bot_Name);

    Create_table(PlayerArr, PlayerWater);

    system("pause");
    system("cls");

    int choise;
    cout << "Желаете ли Вы автоматически расстановить корабли или сами? \n\t Нажмите 1, если автоматически, \n\t Нажмите 2, если сами.. \n Ваш выбор: ";
    cin >> choise;
    system("cls");

    if (choise == 1) {
        Set_ships(PlayerArr, 3);
    }

    else {
        Set_ships(PlayerArr, 1);
    }

    Create_table(BotArr, BotWater);
    Set_ships(BotArr, 2);

    system("pause");
    system("cls");

    cout << "Добро пожаловать в игру, " << Player_Name << "! \n";
    cout << "Сегодня Вы будете играть против бота с никнеймом " << Bot_Name << ". \n";

    cout << "Желаем ";

    SetConsoleTextAttribute(h, 2);

    cout << "хорошей";

    SetConsoleTextAttribute(h, 7);

    cout << " игры!" << endl;
    system("pause");
    system("cls");

    cout << "\t BETA TEST" << endl << endl;
    cout << "Поле игрока с именем (или никнеймом) " << Player_Name << endl;
    Print_table(PlayerArr);

    cout << endl;

    cout << "Поле игрока с именем (или никнеймом) " << Bot_Name << endl;
    Print_table(BotArr);

    system("pause");
    system("cls");

    while (true)
    {
        Player_move(PlayerArr, BotArr, 1, Player_Name, Bot_Name);
        Player_move(PlayerArr, BotArr, 2, Player_Name, Bot_Name);
        Win(amount_of_ship_cells_left_to_drown_P1);
        Win(amount_of_ship_cells_left_to_drown_P2);

        if (Win(amount_of_ship_cells_left_to_drown_P2) == true) {
            ifPlayerWin(Player_Name);
        }

        else if (Win(amount_of_ship_cells_left_to_drown_P1) == true) {
            ifBotWin(Bot_Name);
        }

        cout << "Поле игрока с именем (никнеймом) " << Player_Name << endl << endl;
        Print_table(PlayerArr);

        cout << endl;

        cout << "Поле игрока с именем (никнеймом) " << Bot_Name << endl << endl;
        Print_table(BotArr);

        system("pause");
    }

    system("pause");
    return 0;
}
 
  • Нравится
Реакции: 8_leeeroooy_8
N

Novy

Игра недокончена, но продолжу работу в свободное время. Спасибо всем тем, кто хотел/пытался хотя-бы помочь с игрой! :)
 
  • Нравится
Реакции: Vertigo
Q

QWERTman

Мой вариант консольный C# давным давно
Код:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace seabatl

{



    class Program

    {

        static void Main(string[] args)

        {//

            Random rnd = new Random();

            string[,] seaboat = new string[9, 9]; //{ { '1', '2', '3', '4', '5', '6', '7' }};//'■'

            string[,] sea = new string[9, 9];//'■'

            string[,] seaiiboat = new string[9, 9];//'■'

            string[,] seaii = new string[9, 9];//'■'



            for (int i = 1; i != 8; i++)

            {

                for (int j = 1; j != 8; j++)

                {

                    sea[i, j] = "■";

                    seaboat[i, j] = "■";

                    seaii[i, j] = "■";

                    seaiiboat[i, j] = "■";

                }

            }

            for (int i = 1; i != 8; i++)

            {

                sea[0, i] = i.ToString();

                seaii[0, i] = i.ToString();

                seaboat[0, i] = i.ToString();

                seaiiboat[0, i] = i.ToString();



            }

            sea[0, 0] = " ";

            seaii[0, 0] = " ";

            seaboat[0, 0] = " ";

            seaiiboat[0, 0] = " ";



            sea[1, 0] = "a";

            sea[2, 0] = "b";

            sea[3, 0] = "c";

            sea[4, 0] = "d";

            sea[5, 0] = "e";

            sea[6, 0] = "f";

            sea[7, 0] = "g";



            seaii[1, 0] = "a";

            seaii[2, 0] = "b";

            seaii[3, 0] = "c";

            seaii[4, 0] = "d";

            seaii[5, 0] = "e";

            seaii[6, 0] = "f";

            seaii[7, 0] = "g";



            seaboat[1, 0] = "a";

            seaboat[2, 0] = "b";

            seaboat[3, 0] = "c";

            seaboat[4, 0] = "d";

            seaboat[5, 0] = "e";

            seaboat[6, 0] = "f";

            seaboat[7, 0] = "g";



            seaiiboat[1, 0] = "a";

            seaiiboat[2, 0] = "b";

            seaiiboat[3, 0] = "c";

            seaiiboat[4, 0] = "d";

            seaiiboat[5, 0] = "e";

            seaiiboat[6, 0] = "f";

            seaiiboat[7, 0] = "g";

            bool hod = false;



            bool h = true,doo=false,wasd=false;

            string wtf = "0";



            //<string> names = new List<string>() { "a", "b", "c", "d", "e", "f" ,"g"};

            int one = 4, duo = 2, wat = 0, x = 2, y = 2, boat = 6, boatii = 6,xx=0,yy=0;

            if (one == one )

            {

                for (int i = 0; duo != 0; i++)

                {

                    for (int ii = 0; ii != 8; ii++)

                    {

                        for (int j = 0; j != 8; j++)

                        {



                            Console.Write(seaboat[ii, j] + " ");

                        }

                        Console.WriteLine();

                    }

                    Console.WriteLine("  У вас " + duo + " эсминцев буквы цыфры");



                    try

                    {

                        wtf = Console.ReadLine();

                        y = int.Parse(Console.ReadLine());//a 1





                        switch (wtf)

                        {

                            case "a":

                                {

                                    x = 1;

                                    break;

                                }

                            case "b":

                                {

                                    x = 2;

                                    break;

                                }

                            case "c":

                                {

                                    x = 3;

                                    break;

                                }

                            case "d":

                                {

                                    x = 4;

                                    break;

                                }

                            case "e":

                                {

                                    x = 5;

                                    break;

                                }

                            case "f":

                                {

                                    x = 6;

                                    break;

                                }

                            case "g":

                                {

                                    x = 7;

                                    break;

                                }

                        }







                        if (seaboat[x, y] != "&" && seaboat[(x + 1), y] != "&" && seaboat[(x - 1), y] != "&" && seaboat[x, (y + 1)] != "&" && seaboat[x, (y - 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                        {

                            seaboat[x, y] = "&";



                            ///

                            for (int ii = 0; ii != 8; ii++)

                            {

                                for (int j = 0; j != 8; j++)

                                {



                                    Console.Write(seaboat[ii, j] + " ");

                                }

                                Console.WriteLine();

                            }



                            ///

                            do

                            {

                                Console.WriteLine("w a s d");



                                wtf = Console.ReadLine();

                                if (wtf == "w")

                                {

                                    wtf = "q";

                                    x = x - 1;

                                    if (seaboat[x, y] != "&" && seaboat[(x - 1), y] != "&" && seaboat[x, (y + 1)] != "&" && seaboat[x, (y - 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                                    {

                                        seaboat[x, y] = "&";

                                        duo--;

                                        wtf = "w";

                                    }

                                    x = x + 1;





                                }

                                else if (wtf == "a")

                                {

                                    wtf = "e";

                                    y = y - 1;

                                    if (seaboat[x, y] != "&" && seaboat[(x + 1), y] != "&" && seaboat[(x - 1), y] != "&" && seaboat[x, (y - 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                                    {

                                        seaboat[x, y] = "&";

                                        duo--;

                                        wtf = "a";

                                    }

                                    y = y + 1;



                                }

                                else if (wtf == "s")

                                {

                                    wtf = "r";

                                    x = x + 1;

                                    if (seaboat[x, y] != "&" && seaboat[(x + 1), y] != "&" && seaboat[x, (y + 1)] != "&" && seaboat[x, (y - 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                                    {

                                        seaboat[x, y] = "&";

                                        duo--;

                                        wtf = "s";

                                    }

                                    x = x - 1;

                                }

                                else if (wtf == "d")

                                {

                                    wtf = "t";

                                    y = y + 1;

                                    if (seaboat[x, y] != "&" && seaboat[(x + 1), y] != "&" && seaboat[(x - 1), y] != "&" && seaboat[x, (y + 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                                    {

                                        seaboat[x, y] = "&";

                                        duo--;

                                        wtf = "d";

                                    }

                                    y = y - 1;

                                }

                                else

                                {

                                    Console.WriteLine("eror wasd");

                                }

                                if (wtf == "w" || wtf == "a" || wtf == "s" || wtf == "d")

                                {

                                    h = false;

                                }



                            } while (h);

                            h = true;

                        }

                    }

                    catch

                    {

                        Console.WriteLine("eror");

                        if (wtf == "e")

                        {

                            y = y + 1;

                            seaboat[x, y] = "■";

                        }

                        else if (wtf == "q")

                        {

                            x = x + 1;

                            seaboat[x, y] = "■";

                        }

                        else if (wtf == "r")

                        {

                            x = x - 1;

                            seaboat[x, y] = "■";

                        }

                        else if (wtf == "t")

                        {

                            y = y - 1;

                            seaboat[x, y] = "■";



                        }

                    }

                }

                for (int ii = 0; ii != 8; ii++)

                {

                    for (int j = 0; j != 8; j++)

                    {



                        Console.Write(seaboat[ii, j] + " ");

                    }

                    Console.WriteLine();

                }



                for (int ii = 0; ii != 8; ii++)

                {

                    for (int j = 0; j != 8; j++)

                    {



                        Console.Write(seaboat[ii, j] + " ");

                    }

                    Console.WriteLine();

                }





                for (int i = 0; one != 0; i++)

                {

                    Console.WriteLine("  У вас " + one + " катеров буквыб цыфры");

                    // Console.WriteLine("1=разместить катер );

                    try

                    {

                        //wat = Console.Read();

                        wtf = Console.ReadLine();

                        y = int.Parse(Console.ReadLine());//a 1

                        //  y = int.Parse(Console.ReadLine());

                        // wtf = Console.ReadLine();



                        switch (wtf)

                        {

                            case "a":

                                {

                                    x = 1;

                                    break;

                                }

                            case "b":

                                {

                                    x = 2;

                                    break;

                                }

                            case "c":

                                {

                                    x = 3;

                                    break;

                                }

                            case "d":

                                {

                                    x = 4;

                                    break;

                                }

                            case "e":

                                {

                                    x = 5;

                                    break;

                                }

                            case "f":

                                {

                                    x = 6;

                                    break;

                                }

                            case "g":

                                {

                                    x = 7;

                                    break;

                                }



                        }





                        if (seaboat[x, y] != "&" && seaboat[(x + 1), y] != "&" && seaboat[(x - 1), y] != "&" && seaboat[x, (y + 1)] != "&" && seaboat[x, (y - 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                        {

                            seaboat[x, y] = "&";

                            one--;

                        }

                        else

                        {

                            Console.WriteLine("no");

                        }

                    }

                    catch

                    {

                        Console.WriteLine("eror2");

                    }

                    for (int ii = 0; ii != 8; ii++)

                    {

                        for (int j = 0; j != 8; j++)

                        {



                            Console.Write(seaboat[ii, j] + " ");

                        }

                        Console.WriteLine();

                    }





                }

            }

            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



            one = 4;

            duo = 2;



            for (int i = 0; duo != 0; i++)

            {

                //for (int ii = 0; ii != 8; ii++)

                //{

                //    for (int j = 0; j != 8; j++)

                //    {



                //        Console.Write(seaiiboat[ii, j] + " ");

                //    }

                //    Console.WriteLine();

                //}

                Console.WriteLine("  У вас " + duo + " эсминцев буквы цыфры");





                y = rnd.Next(1, 8);//a 1

                x = rnd.Next(1, 8);











                if (seaiiboat[x, y] != "&" && seaiiboat[(x + 1), y] != "&" && seaiiboat[(x - 1), y] != "&" && seaiiboat[x, (y + 1)] != "&" && seaiiboat[x, (y - 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                {

                    seaiiboat[x, y] = "&";



                    ///

                    //for (int ii = 0; ii != 8; ii++)

                    //{

                    //    for (int j = 0; j != 8; j++)

                    //    {



                    //        Console.Write(seaiiboat[ii, j] + " ");

                    //    }

                    //    Console.WriteLine();

                    //}



                    ///

                    string[] mas = { "w", "a", "s", "d" };

                    do

                    {

                        Console.WriteLine("w a s d");

                        try

                        {

                            wtf = mas[rnd.Next(0, 4)];

                          



                            if (wtf == "w")

                            {

                                wtf = "q";

                                x = x - 1;

                                if (seaiiboat[x, y] != "&" && seaiiboat[(x - 1), y] != "&" && seaiiboat[x, (y + 1)] != "&" && seaiiboat[x, (y - 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                                {

                                    seaiiboat[x, y] = "&";

                                    duo--;

                                    wtf = "w";

                                }

                                x = x + 1;





                            }

                            else if (wtf == "a")

                            {

                                wtf = "q";

                                y = y - 1;

                                if (seaiiboat[x, y] != "&" && seaiiboat[(x + 1), y] != "&" && seaiiboat[(x - 1), y] != "&" && seaiiboat[x, (y - 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                                {

                                    seaiiboat[x, y] = "&";

                                    duo--;

                                    wtf = "a";

                                }

                                y = y + 1;



                            }

                            else if (wtf == "s")

                            {

                                wtf = "q";

                                x = x + 1;

                                if (seaiiboat[x, y] != "&" && seaiiboat[(x + 1), y] != "&" && seaiiboat[x, (y + 1)] != "&" && seaiiboat[x, (y - 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                                {

                                    seaiiboat[x, y] = "&";

                                    duo--;

                                    wtf = "s";

                                }

                                x = x - 1;

                            }

                            else if (wtf == "d")

                            {

                                wtf = "q";

                                y = y + 1;

                                if (seaiiboat[x, y] != "&" && seaiiboat[(x + 1), y] != "&" && seaiiboat[(x - 1), y] != "&" && seaiiboat[x, (y + 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                                {

                                    seaiiboat[x, y] = "&";

                                    duo--;

                                    wtf = "d";

                                }

                                y = y - 1;

                            }

                            else

                            {

                                Console.WriteLine("eror wasd");

                            }

                            if (wtf == "w" || wtf == "a" || wtf == "s" || wtf == "d")

                            {

                                h = false;

                            }

                        }

                        catch

                        {

                            Console.WriteLine("erorii");

                          

                        }

                    } while (h);

                    h = true;

                }





            }

            for (int ii = 0; ii != 8; ii++)

            {

                for (int j = 0; j != 8; j++)

                {



                    Console.Write(seaiiboat[ii, j] + " ");

                }

                Console.WriteLine();

            }























            for (int ii = 0; ii != 8; ii++)

            {

                for (int j = 0; j != 8; j++)

                {



                    Console.Write(seaiiboat[ii, j] + " ");

                }

                Console.WriteLine();

            }





            for (int i = 0; one != 0; i++)

            {

                Console.WriteLine("  У вас " + one + " катеров буквыб цыфры");

                // Console.WriteLine("1=разместить катер );



                //wat = Console.Read();

                x = rnd.Next(1, 8);

                y = rnd.Next(1, 8);//a 1

                //  y = int.Parse(Console.ReadLine());

                // wtf = Console.ReadLine();













                if (seaiiboat[x, y] != "&" && seaiiboat[(x + 1), y] != "&" && seaiiboat[(x - 1), y] != "&" && seaiiboat[x, (y + 1)] != "&" && seaiiboat[x, (y - 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                {

                    seaiiboat[x, y] = "&";

                    one--;

                }

                else

                {

                    Console.WriteLine("no");

                }



                for (int ii = 0; ii != 8; ii++)

                {

                    for (int j = 0; j != 8; j++)

                    {



                        Console.Write(seaiiboat[ii, j] + " ");

                    }

                    Console.WriteLine();

                }





            }





            Console.ReadKey();

            Console.WriteLine("1111111111111111111");

            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            for (bool i = false; i != true; i = false)

            {

                if (boat == 0)

                {

                    Console.WriteLine("win ii");



                }

                else if (boatii == 0)

                {

                    Console.WriteLine("you win");

                }

                else

                {

                    for (int my = 1; my != 0; my--)

                    {

                        try

                        {

                            wtf = Console.ReadLine();

                            y = int.Parse(Console.ReadLine());//a 1





                            switch (wtf)

                            {

                                case "a":

                                    {

                                        x = 1;

                                        break;

                                    }

                                case "b":

                                    {

                                        x = 2;

                                        break;

                                    }

                                case "c":

                                    {

                                        x = 3;

                                        break;

                                    }

                                case "d":

                                    {

                                        x = 4;

                                        break;

                                    }

                                case "e":

                                    {

                                        x = 5;

                                        break;

                                    }

                                case "f":

                                    {

                                        x = 6;

                                        break;

                                    }

                                case "g":

                                    {

                                        x = 7;

                                        break;



                                    }

                                default:

                                    {

                                        x = 9;

                                        Console.WriteLine("eror xy");

                                        break;

                                    }

                            }

                        }

                        catch

                        {

                            x = 9;

                            Console.WriteLine("eror xy");

                        }

                        if (y > 0 && y < 8 && x > 0 && x < 8 && sea[x, y] == "■")

                        {

                            hod = true;

                            for (int ii = 1; ii != 0; ii--)

                            {



                                if (seaiiboat[x, y] == "■")

                                {

                                    seaiiboat[x, y] = "0";

                                    sea[x, y] = "0";

                                    Console.WriteLine("noooo");

                                }

                                else if (seaiiboat[x, y] == "&")

                                {

                                    if (seaiiboat[(x + 1), y] != "&" && seaiiboat[(x - 1), y] != "&" && seaiiboat[x, (y + 1)] != "&" && seaiiboat[x, (y - 1)] != "&" && seaiiboat[(x + 1), (y + 1)] != "&" && seaiiboat[(x + 1), (y - 1)] != "&" && seaiiboat[(x - 1), (y + 1)] != "&" && seaiiboat[(x - 1), (y - 1)] != "&")

                                    {

                                        if (seaiiboat[(x + 1), y] != "#" && seaiiboat[(x - 1), y] != "#" && seaiiboat[x, (y + 1)] != "#" && seaiiboat[x, (y - 1)] != "#" && seaiiboat[(x + 1), (y + 1)] != "#" && seaiiboat[(x + 1), (y - 1)] != "#" && seaiiboat[(x - 1), (y + 1)] != "#" && seaiiboat[(x - 1), (y - 1)] != "#")

                                        {

                                            seaiiboat[x, y] = "@";

                                            sea[x, y] = "@";

                                            Console.WriteLine("yasss1");

                                            boatii--;

                                            my++;

                                        }

                                        else

                                        {

                                            seaiiboat[x, y] = "@";

                                            sea[x, y] = "@";

                                            Console.WriteLine("yasss2");

                                            boatii--;

                                            my++;

                                        }

                                    }



                                    else

                                    {

                                        seaiiboat[x, y] = "#";

                                        sea[x, y] = "#";

                                        Console.WriteLine("50%");

                                        my++;

                                    }





                                }

                                for (int iii = 0; iii != 8; iii++)

                                {

                                    for (int j = 0; j != 8; j++)

                                    {



                                        Console.Write(sea[iii, j] + " ");

                                    }

                                    Console.WriteLine();

                                }





                            }

                        }

                    }







                    if (y > 0 && y < 8 && x > 0 && x < 8 &&hod)

                    {

                        hod = false;

                        for (int ii = 1; ii != 0; ii--)

                    {

                        if (wasd == true)

                        {

                            

                                int rez = rnd.Next(1, 5);

                                x = xx;

                                y = yy;

                                switch (rez)

                                {

                                    

                                    case 1:

                                        {

                                            x = x + 1;

                                            break;

                                        }

                                    case 2:

                                        {

                                            x = x - 1;

                                            break;

                                        }

                                    case 3:

                                        {

                                            y = y - 1;

                                            break;

                                        }

                                    case 4:

                                        {

                                            y = y + 1;

                                            break;

                                        }

                                }

                              

                            

                              

                            }

                        else

                        {

                            x = rnd.Next(1, 8);

                            y = rnd.Next(1, 8);

                        }



                        if (seaboat[x, y] != "&" && seaboat[x, y] != "■" && seaboat[x, y] != "#")

                        {

                            ii++;

                        }

                        else

                        {





                            if (seaboat[x, y] == "■")

                            {

                                seaboat[x, y] = "0";

                                seaii[x, y] = "0";

                                Console.WriteLine("noooo");

                                doo = false;

                            }

                            else if (seaboat[x, y] == "&")

                            {

                                if (seaboat[(x + 1), y] != "&" && seaboat[(x - 1), y] != "&" && seaboat[x, (y + 1)] != "&" && seaboat[x, (y - 1)] != "&" && seaboat[(x + 1), (y + 1)] != "&" && seaboat[(x + 1), (y - 1)] != "&" && seaboat[(x - 1), (y + 1)] != "&" && seaboat[(x - 1), (y - 1)] != "&")

                                {

                                    if (seaboat[(x + 1), y] != "#" && seaboat[(x - 1), y] != "#" && seaboat[x, (y + 1)] != "#" && seaboat[x, (y - 1)] != "#" && seaboat[(x + 1), (y + 1)] != "#" && seaboat[(x + 1), (y - 1)] != "#" && seaboat[(x - 1), (y + 1)] != "#" && seaboat[(x - 1), (y - 1)] != "#")

                                    {

                                        seaboat[x, y] = "@";

                                        seaii[x, y] = "@";

                                        Console.WriteLine("yasss1");

                                        boat--;

                                        ii++;

                                        doo = false;///////

                                        seaboat[(x + 1), y] = "0";

                                        seaboat[(x - 1), y] = "0";

                                        seaboat[x, (y + 1)] = "0";

                                        seaboat[x, (y - 1)] = "0";

                                        seaboat[(x + 1), (y + 1)] = "0";

                                        seaboat[(x + 1), (y - 1)] = "0";

                                        seaboat[(x - 1), (y + 1)] = "0";

                                        seaboat[(x - 1), (y - 1)] = "0";



                                        seaii[(x + 1), y] = "0";

                                        seaii[(x - 1), y] = "0";

                                        seaii[x, (y + 1)] = "0";

                                        seaii[x, (y - 1)] = "0";

                                        seaii[(x + 1), (y + 1)] = "0";

                                        seaii[(x + 1), (y - 1)] = "0";

                                        seaii[(x - 1), (y + 1)] = "0";

                                        seaii[(x - 1), (y - 1)] = "0";



                                        for (int a = 1; a != 8; a++)

                                        {

                                            seaii[0, a] = a.ToString();

                                            seaboat[0, a] = a.ToString();



                                        }

                                        seaii[0, 0] = " ";

                                        seaboat[0, 0] = " ";



                                        seaboat[1, 0] = "a";

                                        seaboat[2, 0] = "b";

                                        seaboat[3, 0] = "c";

                                        seaboat[4, 0] = "d";

                                        seaboat[5, 0] = "e";

                                        seaboat[6, 0] = "f";

                                        seaboat[7, 0] = "g";

                                        seaii[1, 0] = "a";

                                        seaii[2, 0] = "b";

                                        seaii[3, 0] = "c";

                                        seaii[4, 0] = "d";

                                        seaii[5, 0] = "e";

                                        seaii[6, 0] = "f";

                                        seaii[7, 0] = "g";

                                    }

                                    else

                                    {

                                            wasd = false;

                                        seaboat[x, y] = "@";

                                        seaii[x, y] = "@";

                                        Console.WriteLine("yasss2");

                                        boat--;

                                        ii++;

                                        doo = false;

                                            seaboat[(x + 1), y] = "0";

                                            seaboat[(x - 1), y] = "0";

                                            seaboat[x, (y + 1)] = "0";

                                            seaboat[x, (y - 1)] = "0";

                                            seaboat[(x + 1), (y + 1)] = "0";

                                            seaboat[(x + 1), (y - 1)] = "0";

                                            seaboat[(x - 1), (y + 1)] = "0";

                                            seaboat[(x - 1), (y - 1)] = "0";



                                            seaii[(x + 1), y] = "0";

                                            seaii[(x - 1), y] = "0";

                                            seaii[x, (y + 1)] = "0";

                                            seaii[x, (y - 1)] = "0";

                                            seaii[(x + 1), (y + 1)] = "0";

                                            seaii[(x + 1), (y - 1)] = "0";

                                            seaii[(x - 1), (y + 1)] = "0";

                                            seaii[(x - 1), (y - 1)] = "0";



                                            for (int a = 1; a != 8; a++)

                                            {

                                                seaii[0, a] = a.ToString();

                                                seaboat[0, a] = a.ToString();



                                            }

                                            seaii[0, 0] = " ";

                                            seaboat[0, 0] = " ";



                                            seaboat[1, 0] = "a";

                                            seaboat[2, 0] = "b";

                                            seaboat[3, 0] = "c";

                                            seaboat[4, 0] = "d";

                                            seaboat[5, 0] = "e";

                                            seaboat[6, 0] = "f";

                                            seaboat[7, 0] = "g";

                                            seaii[1, 0] = "a";

                                            seaii[2, 0] = "b";

                                            seaii[3, 0] = "c";

                                            seaii[4, 0] = "d";

                                            seaii[5, 0] = "e";

                                            seaii[6, 0] = "f";

                                            seaii[7, 0] = "g";

                                        }

                                }



                                else

                                {

                                    seaboat[x, y] = "#";

                                    seaii[x, y] = "#";

                                    Console.WriteLine("50%");

                                        ii++;

                                        wasd = true;

                                   // doo = true;

                                      

                                    xx = x;

                                    yy = y;





                                }





                            }

                            for (int iiii = 0; iiii != 8; iiii++)

                            {

                                for (int j = 0; j != 8; j++)

                                {



                                    Console.Write(seaii[iiii, j] + " ");

                                }

                                Console.WriteLine();

                            }





                        }





                    }

                }

                  

                    else

                    {

                        Console.WriteLine("eror 0");

                    }

                    }

                }

            }//



        }



    }
 
Последнее редактирование модератором:
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!