#include "vision.h"

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

int getMove1d(std::vector<int> v)
{
    if(v.size() == 3)
    {
        /**if(v[0] == 2 && v[2] == 3)
            return 2;
        else if(v[0] == 3 && v[2] == 2)
            return 0;
        else if(v[0] == 3 && v[2] == 1)
            return 2;
        else if(v[0] == 1 && v[2] == 3)
            return 0;
        else if(v[0] == 1 && v[2] == 2)
            return 2;
        else
            return 0;*/
            
        if(v[0] == 1 && v[2] == 1)
            return 0;
        if(v[0] == 1 && v[2] == 2)
            return 2;
        else if(v[0] == 2 && v[2] == 1)
            return 0;
        else if(v[0] == 2 && v[2] == 3)
            return 2;
        else if(v[0] == 3 && v[2] == 2)
            return 0;
        if(v[0] == 1 && v[2] == 3)
            return 0;
        else
            return 2;
    }
    if(v.size() == 5)
    {
        if(v[0] == 3)
            return 0;
        return 4;
    }
    if(v.size() == 7)
    {
        if(v[0] == 2)
            return 0;
        return 6;
    }
    return 0;
}

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

std::pair<int, int> getMove2d(std::vector<std::vector<int>> vv)
{
    std::vector <int> v = vv[0];
    if(v.size() == 3)
    {
        if(v[0] == 2)
            return {0 , 0};
        else
            return {0 , 2};
    }
    if(v.size() == 5)
    {
        if(v[4] == 1 && v[3] == 3)
            return {0 , 4};
        else
            return {0 , 0};
    }
    if(v.size() == 7)
    {
        if(v[6] == 3 && v[5] == 2)
            return {0 , 6};
        else
            return {0 , 0};
    }
    return {0 , 0};
}
