您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ think函数代码示例

51自学网 2021-06-03 08:48:06
  C++
这篇教程C++ think函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中think函数的典型用法代码示例。如果您正苦于以下问题:C++ think函数的具体用法?C++ think怎么用?C++ think使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了think函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setTargets

path *spreadExecSearchAlgorithm::GetPath(GraphAbstraction *_aMap, node *from, node *to, reservationProvider *_rp){	setTargets(_aMap, from, to, _rp);	path *p;	while ((p = think()) == 0) {}	return p;}
开发者ID:DavidMChan,项目名称:hog2,代码行数:7,


示例2: think

void Zombie::prepare(double cx, double cy, Radar *smells, Radar * sounds) {	double smx, smy, sox, soy;	bool smv, sov;	smells->getValue(x, y, smx, smy, smv);	sounds->getValue(x, y, sox, soy, sov);	double v1x, v1y, v2x, v2y;	v1x = v1y = v2x = v2y = 0;	if (smv) {		v1x = smx - x;		v1y = smy - y;	}	if (sov) {		v2x = sox - x;		v2y = soy - y;	}	for (int i = 0; i < output.size(); ++i) {		input[i] = output[i];	}	input[4] = x - cx;	input[5] = y - cy;	input[6] = v1x;	input[7] = v1y;	input[8] = v2x;	input[9] = v2y;	for (int i = 0; i < input.size(); ++i) {		if (!std::isfinite(input[i])) log(VERBOSE_ERRORS, "BAD INPUT %d", i);	}	think();}
开发者ID:Dewcs,项目名称:Zurvival,代码行数:29,


示例3: philoT

void* philoT(void *philoID){	unsigned int myID = *((unsigned int *)philoID);	//printf("%i/n", myID);	int ready = 1;	int totalEat = 0;	//printf("%i/n", myID);	while(totalEat < 20){		//printf("Philo %d created and waiting for chopsticks/n", myID);		//fflush(stdout);		while(ready) {			ready = acquire(myID);			sleep(1);		}		//printf("Philo %d has chopsticks, running eat function/n", myID);		//fflush(stdout);		totalEat += eat(myID);		printf(" ***** Philo %d has eaten for %d seconds *****/n", myID, totalEat);		fflush(stdout);		pthread_mutex_unlock(&chopstick[myID]);		pthread_mutex_unlock(&chopstick[(myID + 1) % 5]);		//printf("Philo %d is thinking/n", myID);		//fflush(stdout);		think(myID);			//printf("Philo %d is done thinking/n", myID);		fflush(stdout);	}	printf("Philo %d has finished eating and has left the table./n", myID);	return 0;}
开发者ID:BobLocke,项目名称:Classwork,代码行数:29,


示例4: think

void PlayerPanel::think(){    UI::Base::think();    auto game = Game::getInstance();    for (auto it = _ui.begin(); it != _ui.end(); ++it)    {        (*it)->think();    }    // object in hand    if (auto item = game->player()->currentHandSlot())    {        auto itemUi = item->inventoryDragUi();        itemUi->think();    }    if (_scrollingLogTimer && (SDL_GetTicks() > _scrollingLogTimer + 150)        && ((_scrollingLog < 0 && _messageLog->lineOffset() > 0)            || (_scrollingLog > 0 && _messageLog->lineOffset() < _messageLog->numLines() - 6)))    {        _messageLog->setLineOffset(_messageLog->lineOffset() + _scrollingLog);        _scrollingLogTimer = SDL_GetTicks();    }}
开发者ID:CynicRus,项目名称:falltergeist,代码行数:26,


示例5: philosopher

void philosopher(int i){    while(TRUE)    {        think();    }}
开发者ID:akshatakrao,项目名称:spring2014,代码行数:7,


示例6: while

void	*start_meeting(void *p){  unsigned int	rcs;  unsigned int	lcs;  t_sceptiques	*philosopher;  philosopher = (t_sceptiques*)p;  while (philosopher->rice)    {      pthread_mutex_lock(&g_m);      lcs = g_chopsticks[philosopher->id];      rcs = g_chopsticks[RCS(philosopher->id)];      if (philosopher->status != EATING && lcs == 0 && rcs == 0)	eat(philosopher);      else if (philosopher->status != EATING &&	       philosopher->status != THINKING &&	       lcs == 0)	think(philosopher);      else	rest(philosopher);    }  philosopher->status = LEFT;  pthread_exit(NULL);  return 0;}
开发者ID:mockingbirdnj83,项目名称:philosophes,代码行数:25,


示例7: bench

void bench(){	int i;	int t[3];	double nps;	/* setting the position to a non-initial position confuses the opening	   book code. */	close_book();	for (i = 0; i < 64; ++i) {		color[i] = bench_color[i];		piece[i] = bench_piece[i];	}	side = LIGHT;	xside = DARK;	castle = 0;	ep = -1;	fifty = 0;	ply = 0;	hply = 0;	set_hash();	print_board();	max_time = 1 << 25;	max_depth = 5;	for (i = 0; i < 3; ++i) {		think(1);		t[i] = get_ms() - start_time;		printf("Time: %d ms/n", t[i]);	}	if (t[1] < t[0])		t[0] = t[1];	if (t[2] < t[0])		t[0] = t[2];	printf("/n");	printf("Nodes: %d/n", nodes);	printf("Best time: %d ms/n", t[0]);	if (!ftime_ok) {		printf("/n");		printf("Your compiler's ftime() function is apparently only accurate/n");		printf("to the second. Please change the get_ms() function in main.c/n");		printf("to make it more accurate./n");		printf("/n");		return;	}	if (t[0] == 0) {		printf("(invalid)/n");		return;	}	nps = (double)nodes / (double)t[0];	nps *= 1000.0;	/* Score: 1.000 = my Athlon XP 2000+ */	printf("Nodes per second: %d (Score: %.3f)/n", (int)nps, (float)nps/243169.0);	init_board();	open_book();	gen();}
开发者ID:johnwbyrd,项目名称:superpawn,代码行数:59,


示例8: while

void *dining (int n) {	while(1) {		think(n);		printf("Philosopher #%d is hungry.../n", n);		eat(n);		printf("Philosopher #%d finished eating/n", n);	}}
开发者ID:ElFeo,项目名称:GTThreads,代码行数:8,


示例9: target_stuff

void Control::calculate(){    STACKTRACE;    if (!exists())        return;    target_stuff();    if (ship) {        if (!ship->exists() || (ship->death_counter != -1)) {            //message.print(5000, 12, "Ship died in frame %d", game->frame_number);            select_ship( NULL, NULL);        }        else keys = think();    }    if (!ship) {        keys = 0;        if (temporary)            state = 0;    }    if (channel != Game::channel_none) {        //prediction stuff        _prediction_keys[_prediction_keys_index] = keys;        _prediction_keys_index = (_prediction_keys_index + 1) & (_prediction_keys_size-1);        //network prep for dieing (set state to unbuffering)        if (!ship && temporary && (already > 0)) already = -already;        //network traffic        int lf = game->lag_frames;        if (0) ;        else if (already < 0) {            //unbuffering            game->log->unbuffer(channel + Game::_channel_buffered, &keys, sizeof(KeyCode));            keys = intel_ordering_short(keys);            already += 1;        }        else if (already < lf) {            //buffering            keys = intel_ordering_short(keys);            game->log->buffer(channel + Game::_channel_buffered, &keys, sizeof(KeyCode));            keys = intel_ordering_short(keys);            already += 1;        }        else if (already > lf) {            //stupid error check            tw_error("Control::calculate() - inconcievable!");        }						 //stable, perform no action        else {            game->log_short(channel + Game::_channel_buffered, keys);        }    }    return;}
开发者ID:argarak,项目名称:tw-light,代码行数:58,


示例10: while

void *philosopher(int *j){  int i=*j;  while(1){    think(i);    take_fork(i);    eat(i);    leave_fork(i);  }}
开发者ID:peteraldaron,项目名称:BunchOfRandomCode,代码行数:9,


示例11: think

//------------------------------------------------------------------------------Position *repl_think(Position *self) {    Move move = think();    if (move) {        char buffer[512];        self = make_move(self, move);        printf("%s/n", position_string(self, buffer));    }    return self;}
开发者ID:michaeldv,项目名称:donna_vista,代码行数:10,


示例12: think

unsigned int CCreature::act(){    if(creatures_map[x + (y << 8)] != this)    {        delete this;        return 0;    }    return think();}
开发者ID:arthur-hav,项目名称:QuickRL,代码行数:9,


示例13: autoget

void autoget(int *x, int *y){	think();	print_score();	getmax();	*x = maxpoint.row;	*y = maxpoint.col;	printf("Player 2 : %d %d/n", *x, *y);}
开发者ID:guolilong2012,项目名称:study,代码行数:9,


示例14: run

    void run()    {        std::atomic<unsigned int> p1, p2;        bool canEat(false);        while (!stopflag.load()) {            think();            p1 = leftfork->get_priority();            p2 = rightfork->get_priority();            // Get status            shed_mutex.lock();            canEat = shed->get_status(id);            shed_mutex.unlock();            if (!canEat && !stopflag.load()) {                while (!stopflag) {                    shed_mutex.lock();                    if (shed->get_status(id)) {                        shed_mutex.unlock();                        break;                    } else {                        shed_mutex.unlock();                        std::this_thread::yield();                    }                }            }            if (stopflag.load()) {                break;            }            if (p1 < p2) {                leftfork->take();                if (debugflag) std::printf("[%2d] took left fork/n", id);                rightfork->take();                if (debugflag) std::printf("[%2d] took right fork/n", id);                eat();                rightfork->put();                if (debugflag) std::printf("[%2d] put right fork/n", id);                leftfork->put();                if (debugflag) std::printf("[%2d] put left fork/n", id);            } else {                rightfork->take();                if (debugflag) std::printf("[%2d] took right fork/n", id);                leftfork->take();                if (debugflag) std::printf("[%2d] took left fork/n", id);                eat();                leftfork->put();                if (debugflag) std::printf("[%2d] put left fork/n", id);                rightfork->put();                if (debugflag) std::printf("[%2d] put right fork/n", id);            }            shed_mutex.lock();            shed->finished(id);            shed_mutex.unlock();        }    }
开发者ID:densamoylov,项目名称:yandexschool_pdc2015,代码行数:57,


示例15: resetThinkSleep

	void Enemy::update( double _deltaTime)	{		if(m_currentThinkSleep > m_maxThinkSleep)		{			resetThinkSleep();			think();		}		m_currentThinkSleep+=_deltaTime;		GameObject::update(_deltaTime);	}
开发者ID:Jojendersie,项目名称:Lightingbolt,代码行数:10,


示例16: togdb_eval_as_string

void CChange::OnSet() { CString dst ; CString val; name.GetWindowText(dst); value.GetWindowText(val); CString ass = dst + "=" + val; CString b = togdb_eval_as_string ((const char *)ass); think();}
开发者ID:kjseefried,项目名称:pm3,代码行数:10,


示例17: think

BOOL CChange::OnInitDialog() { CDialog::OnInitDialog();  // TODO: Add extra initialization here name.SetWindowText(sname);	 think(); return TRUE;			// return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE}
开发者ID:kjseefried,项目名称:pm3,代码行数:10,


示例18: philosoper

void philosoper(int i) { // i: philospher number, from 0 to 4	while (true) {		think();  // philisopher is thinking		take_fork(i); // take left fork		take_for((i + 1) % N); // take right fork; % is modulo operator		eat(); // yum-yum, spaghetti		put_fork(i); // put left fork back on the table		put_fork((i + 1) % N); // put right fork back on the table	}}
开发者ID:supr,项目名称:algorithms,代码行数:10,


示例19: main_loop

void* main_loop(void* phil) {	while(1) {		hungry((int)phil);		for(i = 0; i<99999999; i++);		think((int)phil);		for(i = 0; i<99999999; i++);	}		}
开发者ID:kunalp320,项目名称:gtthreads,代码行数:10,


示例20: philosopher

void* philosopher(void* i){	int p = (int) i;	while(1){		think(p);	    take_forks(p);	 	eat(p);		put_forks(p);	}	return 0;}
开发者ID:guilhermealles,项目名称:Sisop-2.1,代码行数:11,


示例21: p_five

int p_five(){   int i=0;   srandom(time(0));restart:  setutmpmode(FIVE);  showtitle("天地五子棋", BOARDNAME);  outs("┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐/n");for(sum=0;sum<20;sum++)  outs("├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤/n");  outs("└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘/n");   gotoxy(48,1); outs("=-=-=-=-=-=-=-=-=-=");   gotoxy(48,2); outs("|   天地五子棋    |");   gotoxy(48,3); outs("=-=-=-=-=-=-=-=-=-=");   who(0); who(1);   gotoxy(45,17); outs(" ↓↑→← >> 控制方向");   gotoxy(45,18); outs("  空白
C++ thisMObject函数代码示例
C++ thing_model_name函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。