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


#include "graph.hpp"
#include "labyrinth.hpp"
#include "map.h"

const graph map[12] = {
    {'A', 'B', 5},
    {'B', 'C', 7},
    {'A', 'C', 2},
    {'A', 'E', 2},
    {'A', 'H', 3},
    {'E', 'D', 6},
    {'D', 'F', 1},
    {'F', 'C', 4},
    {'C', 'G', 2},
    {'H', 'G', 1},
    {'H', 'C', 4},
    {'B', 'D', 8}
};

const char * labMap = 
"111111111111"\
"1    1     1"\
"1    1 1   1"\
"1  111 1   1"\
"1      1   1"\
"11111111   1"\
"1          1"\
"1   11111111"\
"1          1"\
"1          1"\
"1          1"\
"111111111111";

int main()
{
    graphfind p(map,12);
    p.fromTo('A','G');

    cout << "found " << p.found() << endl;

    for (int i=0;i<p.size();i++)
    {
        cout << (char)p.at(i).parent << " to " 
             << (char)p.at(i).index << " cost " 
             << p.at(i).cost << endl;
    }
    
    labyrinth l(labMap,12,12);
    
    l.fromTo(INDEX(2,2,12), INDEX(8,8,12));
    cout << "found " << l.found() << endl;
    for (int i=0;i<12*12;i++)
    {
        bool huh = true;
        for (int j=0;j<l.size();j++)
            if (l.at(j).index == i)
            {
                cout << '.';
                huh = false;
            }
        if (huh)
            cout << *(labMap+i);
        if (!NOTEDGERG(i,12,11))
            cout << endl;
    }
    
    
    return 0;
}
