#include <iostream>
#include <vector>
using namespace std;


#include "path.hpp"


void affiche(const char * map,int w, int h)
{
    for (int y=0;y<h;y++)
    {
        for (int x=0;x<w;x++)
            cout << *(map+_index(x,y,w));
        cout << endl;
    }
}

int main()
{

    
/* MATRIX TEST */
    char * sample = \
        "##############"\
        "#            #"\
        "#        #   #"\
        "#   #    #   #"\
        "#   ###  #   #"\
        "#   #    #   #"\
        "#   # ####   #"\
        "#   #    #   #"\
        "#            #"\
        "##############";
    int result[140];



    affiche(sample,14,10);
    vector<node> * tmp = pathfind(sample, _index(2,2,14),_index(9,9,14),14,10);
    
    vector<node>::iterator it = tmp->begin();
    while (it!=tmp->end())
    {
        result[it->pos] = it->cost;
        it++;
    }
    for (int i=0;i<140;i++)
        if (i%14==13)
            cout << result[i] << endl;
        else
            cout << result[i] << "|";
    
    return 0;
}
