Exemplo n.º 1
0
int position_check(token_t *tree) {
	int ret = 0;
	while (tree->cdr->tt != END) {
		if (tree->tt == OPEN) {
			if (tree->cdr->tt == INT || tree->cdr->tt == DOUBLE) {
				printf("No operator between numbers\n");
				return -1;
			}
			if (tree->car->tt == END) {
				printf("You need one term at least\n");
				return -1;
			}
			ret = position_check(tree->car);
		} else if (tree->tt == tree->cdr->tt ||
				(tree->tt == INT && tree->cdr->tt == OPEN) ||
				(tree->tt == DOUBLE && tree->cdr->tt == OPEN)
				) {
			if (tree->tt == OPERATOR)
				printf("No number between operators\n");
			else if (tree->tt == INT || tree->tt == DOUBLE)
				printf("No operator between numbers\n");
			return -1;
		}
		tree = tree->cdr;
	}
	/*The token type before CLOSE bracket must be INT or DOUBLE*/
	if (tree->tt == OPERATOR && tree->counter != 5) {
		printf("operator can\'t be just before the last \')\'\n");
		return -1;
	}
	return ret;
}
Exemplo n.º 2
0
 void paddle::update()
 {
     //std::cout<<110<<"\n";
     move();
     position_check();
     //if(*dirc!=0){
         //std::cout<<*dirc<<"\n";
     //}
     //std::cout<<dirc<<"\n";
 }
Exemplo n.º 3
0
void heal_update(void)
{
	CREATURE *crit=0;

	for(crit = creature_list; crit; crit = crit->next)
	{
		if(crit->hp < -4)
			hurt(crit,1);
		else if(crit->hp < crit->max_hp)
			heal(crit,1);

		if(crit->move < crit->max_move && crit->hp > 0)
			crit->move++;

		position_check(crit);
	}
}