public boolean checkValid(int r, int c, Intersection.Piece p) {
		if(r<0||r>=9||c<0||c>=9){
			return false;
		}
		boolean valid = false;
		boolean checked[][] = new boolean[9][9];
		Intersection tempBoard[][] = new Intersection[9][9];
		copyBoard(tempBoard);
		if (tempBoard[r][c].getContents() == Intersection.Piece.EMPTY) {
			tempBoard[r][c].setContents(p);
			checkRemovalGroup(r + 1, c, tempBoard, checked, p);
			checkRemovalGroup(r - 1, c, tempBoard, checked, p);
			checkRemovalGroup(r, c + 1, tempBoard, checked, p);
			checkRemovalGroup(r, c - 1, tempBoard, checked, p);
			List<Coord> group = new ArrayList<Coord>();
			if (checkGroup(r, c, tempBoard[r][c].getContents(), checked, group,
					0, tempBoard) != 0) {
				valid = true;
			}
			for(int i=0;i<history.size();i++){
				if(equalBoards(tempBoard,history.get(i))){
					return false;
				}
			}
		}
		return valid;
	}