public Double getUtilityIfAlreadyFound(int key[], int curdepth) {

    if (viewedPos != null) {
      AnalysedPosition alreadyAnalysedPos = viewedPos.search(key);
      if (alreadyAnalysedPos != null && alreadyAnalysedPos.getDepth() >= curdepth) {
        return new Double(alreadyAnalysedPos.getUtility());
      }
    }
    return null;
  }
 // testing: make sure that the position didn't suddenly get on the list.
 public void sanityTestPositionDidntDissapearOffTree(
     AnalysedPosition alreadyAnalysedPos, int key[], boolean alreadyDidPos, int curdepth) {
   // note: this should not happen within this function.
   if (viewedPos != null) {
     alreadyAnalysedPos = viewedPos.search(key);
     if (alreadyAnalysedPos != null && alreadyDidPos == false) {
       if (alreadyAnalysedPos.getDepth() >= curdepth) {
         System.out.println("ERROR: Position should have been viewable earlier");
         System.exit(1);
       }
     }
   }
 }