#include<bits/stdc++.h>
#include "vision.h"

std::vector<int> getVisionPattern1d() {
    return {2, 1, 1, 2, 2, 1};
}
std::map<std::vector<int>, int> go = {
    {{1, 1, 2, 2, 1}, 1},
    {{1, 2, 2, 1, 1}, -1},
    {{1, 2, 2, 1, 2}, 2},
    {{2, 1, 2, 2, 1}, -2},
    {{2, 1, 2, 1, 1}, 2},
    {{1, 1, 2, 1, 2}, -2}
};
int getMove1d(std::vector<int> v) {
    int mid = v.size() / 2;
    if (v[mid] == 1) {
        if (v[mid - 1] == 2) return mid - 1;
        if (v[mid + 1] == 2) return mid + 1;
    }
    if (v[mid] == 2) {
        return go[v];
    }
    return -1;
}
std::vector<std::vector<int>> getVisionPattern2d() {
    return {{1, 1, 2, 3}};
}
std::vector<std::pair<int, int>> dir = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
std::pair<int, int> getMove2d(std::vector<std::vector<int>> vv) {
    int mid = vv.size() / 2;
    return {mid, getMove1d(vv[mid])};
}