Esempio n. 1
0
Region::const_iterator Board::find(const Region& ss, const Piece &value) const {
    for (auto s = ss.cbegin(); s != ss.cend(); s++) {
        if (at(s->file(),s->rank()) == value)
            return s;
    }
    return ss.cend();
}
Esempio n. 2
0
int Board::count_repeats(const Region& ss, const Piece &value) const {
    int result = 0;
    bool repeating = false;
    int count = 0;
    for (auto s = ss.cbegin(); s != ss.cend(); s++)
        if (at(s->file(),s->rank()) == value) {
            if (repeating)
                count++;
            else
                count = 1;
            if (count > result)
                result = count;
            repeating = true;
        } else
            repeating = false;
    return result;
}
Esempio n. 3
0
void Board::operator()(const Region& ss, const Piece &value) {
    for (auto s = ss.cbegin(); s != ss.cend(); s++)
        place(s->file(),s->rank(),value);
}