#include "GridNavigatorAutomatic.h"
#include <iostream>
GridNavigatorAutomatic::GridNavigatorAutomatic() : GridNavigator()
{
}

void GridNavigatorAutomatic::Navigate()
{
	
moveresults mr;




	//do 
	//x can be changed for a more definate chance of getting target however the lower the number the more accurate it is 
		for (int x=0; x <= 1; x++)
		   { 
			for (int i = 0; i <= 20; i++)
			{
				mr = grid->MovePlayer(movedirection::up);
				mr = grid->MovePlayer(movedirection::right);
			}
			for (int i = 0; i <= 20; i++)
			{
				mr = grid->MovePlayer(movedirection::up);
				mr = grid->MovePlayer(movedirection::left);
			}
		   }
		

		do
		{ 
			for(int t=0; t<=20; t++)
				{
			mr = grid->MovePlayer(movedirection::right);
			if (grid->MovePlayer(movedirection::right) == moveresults::wall)
			{
				//cout << "hit a wall" << endl;
			}
				}
			
			grid->CheckComplete();
			cout << grid->CheckComplete() << endl;
			mr == moveresults::complete;

		} while (grid->CheckComplete() == 0);

	//} while (mr != moveresults::complete);
} 
	//--------\\
/*int direction = dist(rng);
		/*random_device dev;
		mt19937 rng(dev());
		uniform_int_distribution<mt19937::result_type> dist(0,3);

		moveresults mr;
		do
		{
		int direction = dist(rng);
		switch (direction)
		{

		case 0:
				mr = grid->MovePlayer(movedirection::up);
				break;
		case 1:
			mr = grid->MovePlayer(movedirection::right);
			break;
		case 2:
			mr = grid->MovePlayer(movedirection::left);
			break;
		

		} while (mr != moveresults::complete);*/	

		/*for (int i = 1; i <= 20; i++)
			{

			if (Grid::CheckComplete)
			{

				cout<<"end1";
				return;
			}
			else
			{
				mr = grid->MovePlayer(movedirection::up);


			}
			if  (Grid::CheckComplete)
				{
				cout << "end2";
				return;
				}
				else
				{
					mr = grid->MovePlayer(movedirection::right);


				}
			}


			for (int i = 1; i <= 20; i++)
			{

				if (Grid::CheckComplete)
				{

					cout << "end3";
					return;

				}
				else
				{
					mr = grid->MovePlayer(movedirection::up);


				}
				if (Grid::CheckComplete)
				{
					cout << "end4";
					break;
				}
				else
				{
					mr = grid->MovePlayer(movedirection::right);


				}
			}

			*/
			// i if statment
/*moveresults mr;

grid->GetGrid();


do
{
	for (int x = 0; x <= 100; x++)
	{
		for (int i = 0; i <= 20; i++)
		{
			mr = grid->MovePlayer(movedirection::up);
			mr = grid->MovePlayer(movedirection::right);
		}
		for (int i = 0; i <= 20; i++)
		{
			mr = grid->MovePlayer(movedirection::up);
			mr = grid->MovePlayer(movedirection::left);
		}
	}
	cout << "part1 done" << endl;



	for (int t = 0; t <= 20; t++)
	{
		mr = grid->MovePlayer(movedirection::right);





		grid->CheckComplete();
		cout << grid->CheckComplete() << endl;




	}
} while (mr != moveresults::complete);
}*/