public void solve() {
		BoardState cState = sState;
		visitedList = new ArrayList<BoardState>();
		frontierList = new PriorityQueue<BoardState>(100, heuristic);
		long startTime, endTime, totalTime; //to measure solution time
		startTime = System.nanoTime();
		while (cState != null && !cState.equals(eState)){ //keep going unless all nodes are evaluated or solution is found
			if (!visitedList.contains(cState)) { //expand if not visited
				for (Direction d : Direction.values()) {
					frontierList.add(new BoardState(cState, d));
				}
				visitedList.add(cState);
				nodesExpanded++;
			}
			cState = frontierList.poll(); //get new node from frontier
		}
		endTime = System.nanoTime();
		totalTime = endTime - startTime;
		if (cState == null) {
			System.out.println("Could not find solution after expanding " + nodesExpanded + " nodes. Searched for " + totalTime*1E-6 + "ms.");
		}
		else {
			Display out = new Display();
			System.out.println("Solution found after expanding "+ nodesExpanded + " nodes. Searched for " + totalTime*1E-6 + "ms. Depth: " + cState.getDepth());
			System.out.println(out.solutionToString(cState));
		}
	}