Untitled

mail@pastecode.io avatar
unknown
plain_text
12 days ago
455 B
1
Indexable
Never
void init_field_with_glider(int field[HEIGHT][WIDTH]) {
    // Очищаем поле
    for (int y = 0; y < HEIGHT; y++) {
        for (int x = 0; x < WIDTH; x++) {
            field[y][x] = 0;
        }
    }
    // Добавляем глайдер
    int x = 10, y = 10; // Начальная позиция глайдера
    field[y][x+1] = 1;
    field[y+1][x+2] = 1;
    field[y+2][x] = 1;
    field[y+2][x+1] = 1;
    field[y+2][x+2] = 1;
}
Leave a Comment