get_possible_moves + shallow_search code shortened