package edu.unl.consystlab.sudokuSolver;
import java.util.LinkedList;
import java.util.Stack;
//import java.util.Arrays;

public class backTrackSearch {

	private constraintProblem problem;
	private String[][] Solution;
	private Stack lifoQueue;

	public backTrackSearch(constraintProblem newProblem)
	{
		problem = newProblem;
		lifoQueue = new Stack();
	}

	public void solve()
	{
		//put the preassignes in the queue
		for(int lineIndex = 1; lineIndex <= problem.totalLines; lineIndex++)
		{
			for(int columnIndex = 1; columnIndex <= problem.totalColumns; columnIndex++)
			{
				if(problem.getVariable(lineIndex + "," + columnIndex).isAssigned() )
				{
					problemVariable meh = problem.getVariable(lineIndex + "," + columnIndex);
					lifoQueue.push(meh);
				}
			}
		}
		//get the length of the queue so we know when no solution is found
		int noSolutionCutoff = lifoQueue.size();
		
		//begin in the upper left
		
		
			//if it is not in the queue put it in
				//ititialize it to the first element in its domain
					//check to see if it is consistent
						//if not increment element in domain
							//if this is the last element in the domain pop it off the queue	
								//etc
		
	}
	public void printSolution()
	{
		//int tempMaxQueueSize = lifoQueue.size();
		//for(int i = 0; i < tempMaxQueueSize; i++)
		//{
		//	System.out.println(lifoQueue.pop());
		//}
		//String[][] solution = new String[problem.totalLines][problem.totalColumns];
		//[1][1] = "a";
		//return( solution );
	}
}
