Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
597 B
2
Indexable
Never
#include "Score.hpp"

void checkLines(int field[23][10], int& score) {
    int fieldTem[23][10] = { 0 };
    int x = 23 - 1;
    for (int i = 23 - 1; i >= 4; i--) {
        int count = 0;
        for (int j = 0; j < 10; j++) {
            if (field[i][j]) count++;
        }
        if (count < 10) {
            for (int j = 0; j < 10; j++) {
                fieldTem[x][j] = field[i][j];
            }
            x--;
        }
        else score += 100;
    }
    for (int i = 4; i < 23; i++) {
        for (int j = 0; j < 10; j++) {
            field[i][j] = fieldTem[i][j];
        }
    }
}
Leave a Comment