public boolean isSolved() {

		for (int i = 0; i < NUM_OF_COLUMNS; i++) {
			// get the color at (0, i)
			Color currentColor = grid[0][i];

			if (!currentColor.equals(Color.BLACK)) {
				// start from position (1, i)
				for (int j = 1; j < getNumRows(); j++) {
					if (!grid[j][i].equals(Color.BLACK)
							&& !grid[j][i].equals(currentColor)) {
						return false;
					}
				}
			} else {
				// if the color at (0, i) is black, get color of next square as
				// reference color
				currentColor = grid[1][i];
				// start from position (2, i)
				for (int j = 2; j < getNumRows(); j++) {
					if (!grid[j][i].equals(currentColor)) {
						return false;
					}
				}
			}
		}

		// puzzle is solved
		return true;
	}