static void search_cancel_callback (NautilusDirectory *directory, NautilusDirectoryCallback callback, gpointer callback_data) { NautilusSearchDirectory *search; SearchCallback *search_callback; search = NAUTILUS_SEARCH_DIRECTORY (directory); search_callback = search_callback_find (search, callback, callback_data); if (search_callback) { search->details->callback_list = g_list_remove (search->details->callback_list, search_callback); search_callback_destroy (search_callback); goto done; } /* Check for a pending callback */ search_callback = search_callback_find_pending (search, callback, callback_data); if (search_callback) { search->details->pending_callback_list = g_list_remove (search->details->pending_callback_list, search_callback); search_callback_destroy (search_callback); } done: if (!search->details->callback_list && !search->details->pending_callback_list) { stop_search (search); } }
static void mess() { // clear state variables State->resign_nb = 0; State->exp_move = MoveNone; my_timer_reset(State->timer); // abort a possible search stop_search(); // calculate the new state if (false) { } else if (!active()) { State->state = WAIT; my_log("POLYGLOT WAIT\n"); } else if (XB->analyse) { State->state = ANALYSE; my_log("POLYGLOT ANALYSE\n"); } else if (State->computer[game_turn(Game)]) { State->state = THINK; my_log("POLYGLOT THINK\n"); } else { State->state = WAIT; my_log("POLYGLOT WAIT\n"); } search_update(); }
static void search_monitor_remove (NautilusDirectory *directory, gconstpointer client) { NautilusSearchDirectory *search; SearchMonitor *monitor; GList *list; search = NAUTILUS_SEARCH_DIRECTORY (directory); for (list = search->details->monitor_list; list != NULL; list = list->next) { monitor = list->data; if (monitor->client == client) { search->details->monitor_list = g_list_delete_link (search->details->monitor_list, list); search_monitor_destroy (monitor, search); break; } } if (!search->details->monitor_list) { stop_search (search); } }
void quit() { char string[StringSize]; my_log("POLYGLOT *** QUIT ***\n"); if (Init) { stop_search(); engine_send(Engine,"quit"); // wait for the engine to quit #ifndef _WIN32 while (true) { engine_get(Engine,string,sizeof(string)); // HACK: calls exit() on receiving EOF } #else Idle500msecs();// while(peek_engine_get(Engine,string,StringSize)) Idle(); #endif uci_close(Uci); } exit(EXIT_SUCCESS); }
static void search_force_reload (NautilusDirectory *directory) { NautilusSearchDirectory *search; search = NAUTILUS_SEARCH_DIRECTORY (directory); if (!search->details->query) { return; } search->details->search_ready_and_valid = FALSE; /* Remove file monitors */ reset_file_list (search); stop_search (search); }
static void search_dispose (GObject *object) { NautilusSearchDirectory *search; GList *list; search = NAUTILUS_SEARCH_DIRECTORY (object); clear_base_model (search); /* Remove search monitors */ if (search->details->monitor_list) { for (list = search->details->monitor_list; list != NULL; list = list->next) { search_monitor_destroy ((SearchMonitor *)list->data, search); } g_list_free (search->details->monitor_list); search->details->monitor_list = NULL; } reset_file_list (search); if (search->details->callback_list) { /* Remove callbacks */ g_list_foreach (search->details->callback_list, (GFunc)search_callback_destroy, NULL); g_list_free (search->details->callback_list); search->details->callback_list = NULL; } if (search->details->pending_callback_list) { g_list_foreach (search->details->pending_callback_list, (GFunc)search_callback_destroy, NULL); g_list_free (search->details->pending_callback_list); search->details->pending_callback_list = NULL; } g_clear_object (&search->details->query); stop_search (search); search_disconnect_engine(search); g_clear_object (&search->details->engine); G_OBJECT_CLASS (nautilus_search_directory_parent_class)->dispose (object); }
/** search_check(): Does a periodic check if the search has ended. Note that this "node counter" no longer represents nodes at all, just simply the iterations of our iterative search function. Created 122308; last modified 122308 **/ BOOL search_check(void) { #ifdef SMP if (board.id != 0) return FALSE; #endif #ifdef CLUSTER // if (cluster->id != 0) // return FALSE; #endif zct->nodes_until_check--; if (zct->nodes_until_check > 0) return FALSE; zct->nodes_until_check = zct->nodes_per_check; return stop_search(); }
bool Engine::command(std::stringstream& line) { std::string command; line >> command; if(command == "stop") { Timer::stop(); stop_search(); } else if(command == "ponderhit") {} else if(command == "go") { go(line);} else if(command == "position") { position(line); } else if(command == "setoption") { set_option(line); } else if(command == "ucinewgame"){ new_game(); } else if(command == "isready") { std::cout<<"readyok"<<std::endl; } else if(command == "quit") { return false; } else if(command == "uci") { id(); } else if(command == "print") { pos.print(); } else std::cerr<<"Unknown uci command: "<<command<<std::endl; return true; }
static void search_force_reload (NautilusDirectory *directory) { NautilusSearchDirectory *search; NautilusFile *file; search = NAUTILUS_SEARCH_DIRECTORY (directory); if (!search->details->query) { return; } search->details->search_ready_and_valid = FALSE; /* Remove file monitors */ reset_file_list (search); stop_search (search); file = nautilus_directory_get_corresponding_file (directory); nautilus_file_invalidate_all_attributes (file); nautilus_file_unref (file); }
static int search_handler(int type, int par1, int par2) { static int x0, y0; switch (type) { case EVT_SHOW: //out_page(0); break; case EVT_POINTERDOWN: x0 = par1; y0 = par2; break; case EVT_POINTERUP: if (par1 - x0 > EPSX) { turn_page(-1); return 1; } if (x0 - par1 > EPSX) { turn_page(1); return 1; } if (par1 > ScreenWidth() - searchbm.width && par2 > ScreenHeight() - PanelHeight() - searchbm.height) { if (par1 < ScreenWidth() - searchbm.width / 2) { do_search(stext, spage - 1, -1); } else { do_search(stext, spage + 1, +1); } return 1; } else { stop_search(); } break; case EVT_KEYPRESS: switch (par1) { case KEY_OK: case KEY_BACK: stop_search(); break; case KEY_LEFT: do_search(stext, spage - 1, -1); break; case KEY_RIGHT: do_search(stext, spage + 1, +1); break; default: break; } break; default: break; } return 0; }
void FindInFilesPanel::_on_cancel_button_clicked() { stop_search(); }
/*Equivalente alla search() ma alcune cose non vengono effettuate*/ int search_root(int alpha,int beta,int depth){ int i,c,score,legal,old_depth; unsigned int start_nodes,nws; MOVE m; start_nodes=Nodes; /*questo e' un nuovo nodo da cercare*/ Nodes++; /*controlla se è tempo di abortire la ricerca*/ if(stop_search()) { tree.abort_search=1; return 0; } /*aggiorna la lunghezza della pv corrente*/ tree.pv_lenght[Ply]=Ply; /*estensioni*/ old_depth=depth; /*1-se sotto scacco: estendi la ricerca!*/ if(tree.check[Side][Ply]) depth++; legal=0; nws=0; /*negascout fail-soft alpha beta*/ for (i=0;i<tree.last_root_move;i++) { m=tree.root_move_list[i].move; if(!makemove(m,0)) continue; legal = 1; if (nws) { score = -search( -alpha-1, -alpha, (depth - 1)); if (tree.abort_search) { unmakemove(); return 0; } if (score > alpha && score < beta ) { score = -search( -beta, -alpha, (depth - 1)); } } else score = -search( -beta, -alpha, (depth - 1)); unmakemove(); tree.root_move_list[i].scoren=Nodes-start_nodes; start_nodes=Nodes; if(tree.abort_search) return 0; if(score>alpha) { if(score>=beta) { heuristic(m,old_depth); return (score); } alpha=score; nws=1; /*aggiorna la pv*/ tree.pv[Ply][Ply]=m; heuristic(tree.pv[Ply][Ply],old_depth); for(c=Ply+1;c<tree.pv_lenght[Ply+1];c++) tree.pv[Ply][c]=tree.pv[Ply+1][c]; tree.pv_lenght[Ply]=tree.pv_lenght[Ply+1]; } }/*ciclo mosse*/ /*Se non ci sono mosse legali*/ if(legal==0) { if(tree.check[Side][Ply]) return -INF+Ply; else return DRAW; } return alpha; }
static void no_mess(int move) { ASSERT(move_is_ok(move)); // just received a move, calculate the new state if (false) { } else if (!active()) { stop_search(); // abort a possible search State->state = WAIT; State->exp_move = MoveNone; my_log("POLYGLOT WAIT\n"); } else if (State->state == WAIT) { ASSERT(State->computer[game_turn(Game)]); ASSERT(!State->computer[colour_opp(game_turn(Game))]); ASSERT(!XB->analyse); my_log("POLYGLOT WAIT -> THINK\n"); State->state = THINK; State->exp_move = MoveNone; } else if (State->state == THINK) { ASSERT(!State->computer[game_turn(Game)]); ASSERT(State->computer[colour_opp(game_turn(Game))]); ASSERT(!XB->analyse); if (ponder() && ponder_move_is_ok(Uci->ponder_move)) { my_log("POLYGLOT THINK -> PONDER\n"); State->state = PONDER; State->exp_move = Uci->ponder_move; } else { my_log("POLYGLOT THINK -> WAIT\n"); State->state = WAIT; State->exp_move = MoveNone; } } else if (State->state == PONDER) { ASSERT(State->computer[game_turn(Game)]); ASSERT(!State->computer[colour_opp(game_turn(Game))]); ASSERT(!XB->analyse); if (move == State->exp_move && Uci->searching) { ASSERT(Uci->searching); ASSERT(Uci->pending_nb>=1); my_timer_reset(State->timer); my_timer_start(State->timer); my_log("POLYGLOT PONDER -> THINK (*** HIT ***)\n"); engine_send(Engine,"ponderhit"); State->state = THINK; State->exp_move = MoveNone; send_pv(); // update display return; // do not launch a new search } else { my_log("POLYGLOT PONDER -> THINK (miss)\n"); stop_search(); State->state = THINK; State->exp_move = MoveNone; } } else if (State->state == ANALYSE) { ASSERT(XB->analyse); my_log("POLYGLOT ANALYSE -> ANALYSE\n"); stop_search(); } else { ASSERT(false); } search_update(); }
static void start_protected_command(){ stop_search(); }
/* * Signal handler: call stop_search */ static void handler(int signum) { if (solver.status == STATUS_SEARCHING) { stop_search(&solver); } }