#include "vision.h"
//#include "grader.cpp"

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

int getMove1d(std::vector<int> v)
{
    int sz=v.size();
    int curr=(sz-1)/2;
    int nxt=(curr+1)%3;
    if(nxt==0) nxt=3;
    if(v[curr-1]==nxt) return curr-1;
    else return curr+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)
{
    int sz=v.size();
    int curr=(sz-1)/2;
    int nxt=(curr+1)%3;
    if(nxt==0) nxt=3;

    if(curr==1 or curr==2)
    {
        if(v[curr][curr-1]==nxt) return {curr,curr-1};
        else return {curr,curr+1};
    }
    else
    {
        if(v[curr-1][curr]==nxt) return {curr-1,curr};
        else return {curr+1,curr};
    }
}
