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

using namespace std;

std::vector<int> getVisionPattern1d()
{
    return {1,1,2,1,2,2};
}

int getMove1d(std::vector<int> v)
{
    if(v.size() == 3) {
        if(v[0] == 2) return 0;
        else return 2;
    }
    vector<int>v1={1,1,2,1,2};
    vector<int>v2={2,1,2,2,1};
    vector<int>v3={1,2,2,1,1};
    vector<int>v4={2,1,2,1,1};
    vector<int>v5={1,2,2,1,2};
    vector<int>v6={1,1,2,2,1};
    if(v == v1 or v == v2 or v == v3) return 4;
    else return 0;
}

std::vector<std::vector<int>> getVisionPattern2d()
{
    return {{1,2,3}, {3,1,2}, {2,3,1}};
}

std::pair<int, int> getMove2d(std::vector<std::vector<int>> v)
{
    if(v.size() > 3) {
        for(int i=0; i<v.size(); i++) {
            for(int j=0; j<v[i].size(); j++) {
                if(v[i][j] == 1) return {i,j};
            }
        }
    }
    if(v[0][0] == 3) return {0,0};
    else if(v[0][2] == 3) return {0,2};
    else if(v[2][0] == 3) return {2,0};
    else return {2,2};
}
