public void start() throws InterruptedException {

		Grid clone = initialGrid.clone();
		clone.setOriginal();
		stack.add(clone);
		for (int i = 0; i < threadsCount; i++) {
			threads[i] = new GridWorker(this, i);
			threadStates[i] = false;
			threads[i].start();
		}

		while (!stopCalled) {
			boolean waiting = true;
			synchronized (threadStates) {

				for (int j = 0; j < threadsCount; j++) {
					if (threadStates[j] == false) {
						waiting = false;
						break;
					}
				}
			}

			if (waiting) {
//				boolean allStopped = true;
//				for (int i = 0; i < threadsCount; i++) {
//					if (!threads[i].getIsFinished()) {
//						//System.out.println(i);
//						allStopped = false;
//						break;
//					}
//				}
//				if (allStopped) {
//					System.out.println("breaking");
//					break;
//				}
				break;
			} else {
				synchronized (threadStates) {
					threadStates.wait();
				}
			}

		}
		

	}