#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

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

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

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

std::pair<int, int> getMove2d(std::vector<std::vector<int>> v)
{
    int vis=(v.size()-1)/2;

    if (vis==1)
    {
        for (int i=2 ; i>=0 ; i--)
        {
            for  (int j=2 ; j>=0 ; j--)
            {
                if (v[i][j] == 3) return {i, j};
            }
        }
        for (int i=2 ; i>=0 ; i--)
        {
            for  (int j=2 ; j>=0 ; j--)
            {
                if (v[i][j] == 2) return {i, j};
            }
        }
        return {1, 0};
    }
    if (vis==2)
    {
        if (v[1][1] == 3) return {1, 1};
        if (v[3][3] == 3) return {3, 3};
        if (v[1][3] == 3) return {1, 3};
        if (v[3][1] == 3) return {3, 1};
    }
    if (vis==3)
    {
        if (v[2][4] == 2) return {0, 6};
        if (v[4][4] == 2) return {6, 6};
        if (v[2][2] == 2) return {0, 0};
        if (v[4][2] == 2) return {6, 0};
    }
    while (true){}
}
