#include "vision.h"

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

int getMove1d(std::vector<int> v)
{
    int mij = (int)v.size() / 2;
    if(v[mij+1] % 3 == (v[mij] + 1) % 3)
        return mij + 1;
    else
        return mij - 1;
}

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

std::pair<int, int> getMove2d(std::vector<std::vector<int>> v)
{
    std::pair<int,int> ans;
    int mij = (int)v.size() / 2;
    if(v[0][mij+1] % 3 == (v[0][mij] + 1) % 3)
        ans.first = mij + 1;
    else
        ans.first = mij - 1;
    
    if(v[mij+1][0] % 3 == (v[mij][0] + 1) % 3)
        ans.second = mij + 1;
    else
        ans.second = mij - 1;
    
    return ans;
}
