Проблема в коде на C++

Относительно недавно начал изучать C++, в качестве практики решил написать код, который отрабатывает физику куба (как у логотипа DVD), но при запуске столкнулся с проблемой: "куб" появляется сразу на границе игрового поля. Что делать - не знаю, пытался пофиксить - безрезультатно.

#include <thread>
#include <chrono>
#include <ctime>

void Sleep(int time) {  std::this_thread::sleep_for(std::chrono::milliseconds(time));
}
void SetupBoard(char **board, int x, int y, char corner, char vertical, char horizontal, char inside) {
    for (int i = 0; i < y; i++) {
        for (int j = 0; j < x; j++) {
            if (i == 0 || i == y-1) {
                *(*(board+i)+j) = horizontal;
            }
            else if (j == 0 || j == x-1) {
                *(*(board+i)+j) = vertical;
            }
            else {
                *(*(board+i)+j) = inside;
            }
            if ((i == 0 || i == y-1) && (j == 0 || j==x-1)) {
                *(*(board+i)+j) = corner;
            }
        }
    }
}
void CoutBoard(char **board, int x, int y) {
    for (int i = 0; i < y; i++) {
        for (int j = 0; j < x; j++) {
            std::cout << *(*(board+i)+j);
        }
        std::cout << std::endl;
    }
}
void Move(char **board, int *x, int *y, int size_x, int size_y, int *turn, char inside, char cube) {
    *(*(board+(*y))+*(x)) = inside;
    if (*turn == 0) {
        *y--;
        *x--;
        if (*x == 1 && *y == 1) {*turn = 3;}
        else if (*x == 1) {*turn = 1;}
        else if (*y == 1) {*turn = 2;}
    }
    else if (*turn == 1) {
        *y--;
        *x++;
        if (*x == size_x - 2 && *y == 1) {*turn = 2;}
        else if (*x == size_x - 2) {*turn = 0;}
        else if (*y == 1) {*turn = 3;}
    }
    else if (*turn == 2) {
        *y++;
        *x--;
        if (*x == 1 && *y == size_y - 2) {*turn = 1;}
        else if (*x == 1) {*turn = 3;}
        else if (*y == size_y - 2) {*turn = 0;}
    }
    else if (*turn == 3) {
        *y++;
        *x++;
        if (*x == size_x - 2 && *y == size_y - 2) {*turn = 0;}
        else if (*x == size_x - 2) {*turn = 2;}
        else if (*y == size_y - 2) {*turn = 1;}
    }
    *(*(board+(*y))+*(x)) = cube;
}
int main() {
    srand(time(NULL));
    int size_x = 65, size_y = 32, x = (size_x-2)/ 2, y = (size_y -2)/ 2, turn = rand()%4;
    char vertical = '|', horizontal = '-', corner = '+', cube = '#', inside = ' ';
    char **board {new char *[size_y]};
    for (int i = 0; i < size_y; i++) {
        *(board + i) = new char [size_x];
    }
    SetupBoard(board, size_x, size_y, corner, vertical, horizontal, inside);
    while (true) {
        Move(board, &x, &y, size_x, size_y, &turn, inside, cube);
        system("cls");
        CoutBoard(board, size_x, size_y);
        Sleep(500);
    }
    return 0;
}```

Ответы (0 шт):