function for general search guessing