Ejemplo n.º 1
0
int main()
{
    int i, j, k, p;
    for(i=0;i<10;i++)
    {
        ini[i] = 2*i;
        fim[i] = 2*i+1;
    }
    while(scanf("%d", &N) && N)
    {
        V = 2*N;
        for(i=0;i<N;i++)
        {
            for(j=0;j<N;j++) M[i][j] = 0;
            scanf("%d", &k);
            for(j=0;j<k;j++) scanf("%d", &p), M[i][p-1] = 1;
        }
        if(teste(N)) printf("nenhum mentiroso\n");
        else for(i=0;i<N;i++)
        {
            if(teste(i))
            {
                printf("%d\n", i+1);
                break;
            }
        }
    }
    return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
    // inicia o allegro
    gdp_init();
    // inicia os eventos
    gdp_initevents();

    // inicia o timer
    gdp_timer();

    // exibe splash
   //gdp_splash();

    // se fechou a tela não faz nada
    if(nclose_game==0){
        // exibe o menu
        //gdp_menu();
        opmenu = 1;
        // opção 1 inicia o jogo
        if(opmenu==1){
            //tela de loaging
            //gdp_intro();
            if(nclose_game==0){
                gdp_loaging();
                teste();
            }
            //gdp_game();
        }
    }
    gdp_close();

    return EXIT_SUCCESS;
}
Ejemplo n.º 3
0
int main(){
	teste();
	/*LinkedList *list = list_new();
	int i;
	for (i = 0; i < TAM; i++)
		list_insert(list, i+1);

	//demora aprox 5 segundos a pesquisar todos os elementos da lista 
	for (i = 0; i < TAM; i++)
		list_nth(list, i);
	list_destroy(list);*/
	
	//list_print(list);
	return 0;
}
Ejemplo n.º 4
0
int main ()
{
 FILE *arq;
 char *nome_arq="bancodequestoes.db";
 struct db *questoes = (struct db *) malloc (MAXP*sizeof(struct db));
 int N_perguntas;
 int N_acertos=0;
 int N_porcentagem=0;
 time_t inicio;
 time_t fim;
 
 arq = fopen (nome_arq, "r");
 if (arq == NULL)
   printf("Erro na abertura do banco de questoes. Digite Ctrl + C para sair\n");
 
 inicio = time(NULL);
 N_perguntas= inicializa_db(questoes, arq);
 teste(questoes, N_perguntas);
 fim = time(NULL);
 
 system("CLS");
 N_acertos= confere_respostas(questoes, N_perguntas);
 N_porcentagem= calcula_porcentagem(N_acertos);
 printf("Total de acertos: %d\n", N_acertos );
 
 if (N_porcentagem >= 70)
   {
    printf("Porcentagem de acertos: %d", N_porcentagem);
    printf("%\nResultado final: APROVADO\n");
   }
 else
   {
    printf("Porcentagem de acertos: %d", N_porcentagem);
    printf("%\nResultado final: REPROVADO\n");
   }
 printf("Tempo total: %.f minuto(s)\n", difftime(fim, inicio)/60.0);
   
 printf("\n\n\t######################################################\n");
 printf("\t#             Habilita (C) 2008 by vs06              #\n");
 printf("\t#               Creative Commons 2.5                 #\n");
 printf("\t#            http://www.inf.ufpr.br/vs06             #\n");
 printf("\t######################################################\n");
 
 system("PAUSE");
 return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
void ordenaVooEmpresa(char *dado){
   VooEmpresa *p,*i;
   VooEmpresa *old=NULL;
   int t=1;
    //se a lista estiver vazia
    if(lastQtdeVoo==NULL){
        i->next=NULL;
        i->prior=NULL;
        printf("Lista vazia\n");
        return;
    }

    for(p=startQtdeVoo;p!=NULL;p=p->next){
       for(i=lastQtdeVoo;(i!=p && i!=NULL &&i!=p->prior);i=i->prior){
           if(teste(dado,p,i)/*p->vooTime<i->vooTime*/){
                //printf("ok\n");
                if(i->prior!=p)p->next->prior = i;
                if(p->next!=i)i->prior->next = p;

                if(p->prior)p->prior->next = i;     //não faz no inicio
                else {startQtdeVoo=i;}

                if(i->next)i->next->prior = p;     //não faz no fim
                else {lastQtdeVoo=p;}

                old = i->next;
                if(p->next==i)i->next=p;
                else i->next = p->next;
                p->next = old;

                old = p->prior;
                if(i->prior==p)p->prior=i;
                else p->prior = i->prior;
                i->prior = old;

                old=i;
                i=p;
                p=old;
            }
        }
    }
}
int teste (int total, int distancia, int hectometro, int maximo, int deposito) { /* Função recursiva caso seja necessário calcular mais
																					de uma vez a distância */

	if (hectometro >= total)
		return 0;

	distancia = calculoDistancia(total,maximo);
		
	while (total > 0) {
		deposito = deposito + calculoDeposito(distancia,maximo,total);
		if (total > maximo)
			total = total - maximo;
		else
			total = 0;
	}	
	if (deposito <= maximo && hectometro - distancia < deposito)
		return entrega(deposito,hectometro - distancia);
	
	else
		return teste(deposito,distancia,hectometro-distancia,maximo,0);
}
Ejemplo n.º 7
0
int main(int argv)
{
  Ecore_Evas *ee;
  Evas *canvas;
  Evas_Object *edje;
  ecore_evas_init();
  edje_init();
  ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);

  canvas = ecore_evas_get(ee);
  edje = teste(canvas);

  if (!edje)
    return -2;
  ecore_evas_show(ee);
  ecore_main_loop_begin();
  evas_object_del(edje);
  ecore_evas_free(ee);
  edje_shutdown();
  ecore_evas_shutdown();
  return 0;
}
 virtual void execute( int bits )
  { teste(bits,0.65,3515,0.35,4832) ; }
 virtual void execute( int bits ) { teste(bits,0.35) ; }
Ejemplo n.º 10
0
main()
{
	teste();

}
Ejemplo n.º 11
0
void calculate() {
    int pitchAux = pitch;
    int rollAux = roll;
    int yawControl = yaw;    

    inputControl1 = filter(inputControl1); /* Yaw */
    inputControl2 = filter(inputControl2); /* Pitch */
    inputControl3 = filter(inputControl3); /* Throttle */
    inputControl4 = filter(inputControl4); /* Roll */

    motor1 = motor2 = motor3 = motor4 = inputControl3;
    pitchAux += ((inputControl2 - MIDDLE_CHANNEL2) / 2);
    rollAux += ((inputControl4 - MIDDLE_CHANNEL4) / 2);
    yawControl += ((inputControl1 - MIDDLE_CHANNEL1) / 2);

    /*if (!((pitchAux > zeroGyroPitch - RANGE_GYRO_STILL) && (pitchAux < zeroGyroPitch + RANGE_GYRO_STILL)))
    {
    //if (pitch > zeroGyroPitch)
            motor1 += ((pitchAux - zeroGyroPitch)/8);
            motor2 += ((pitchAux - zeroGyroPitch)/8);
            motor3 -= ((pitchAux - zeroGyroPitch)/8);
            motor4 -= ((pitchAux - zeroGyroPitch)/8);
    }

    if (!((rollAux > zeroGyroRoll - RANGE_GYRO_STILL) && (rollAux < zeroGyroRoll + RANGE_GYRO_STILL)))
    {
            motor1 -= ((rollAux - zeroGyroRoll)/8);
            motor4 -= ((rollAux - zeroGyroRoll)/8);
            motor2 += ((rollAux - zeroGyroRoll)/8);
            motor3 += ((rollAux - zeroGyroRoll)/8);
    }

    if (!((yawAux > zeroGyroYaw - RANGE_GYRO_STILL) && (yawAux < zeroGyroYaw + RANGE_GYRO_STILL)))
    {
            motor1 += ((yawAux - zeroGyroYaw)/8);
            motor3 += ((yawAux - zeroGyroYaw)/8);
            motor2 -= ((yawAux - zeroGyroYaw)/8);
            motor4 -= ((yawAux - zeroGyroYaw)/8);
    }*/

    if (abs(yaw - zeroGyroYaw) > RANGE_GYRO_STILL) {
        if (yaw > zeroGyroYaw) {
            /* Está girando no sentido horário(?) */
            yawAcc += 1;
        } else {
            /* Está girando no sentido anti-horário(?) */
            yawAcc -= 1;
        }
    }

    printf("%d\n\r", yaw);

    motor1 += yawAcc;
    motor3 += yawAcc;
    motor2 -= yawAcc;
    motor4 -= yawAcc;

    if ((inputControl3 > 5) && (inputControl3 < 15)) {
        calibrateGyros();
    }

    if (inputControl3 < 5) {
        motor1 = motor2 = motor3 = motor4 = 0;
        yawAcc = 0;
        yawAccTeste = 0;
        count = 0;
    }
    teste();
    /*if (!((yawControl > zeroGyroYaw - RANGE_GYRO_STILL) && (yawControl < zeroGyroYaw + RANGE_GYRO_STILL)))
    {
        motor1 += ((yawAux - zeroGyroYaw)/8);
        motor3 += ((yawAux - zeroGyroYaw)/8);
        motor2 -= ((yawAux - zeroGyroYaw)/8);
        motor4 -= ((yawAux - zeroGyroYaw)/8);
    }*/

    motor1 = filter(motor1);
    motor2 = filter(motor2);
    motor3 = filter(motor3);
    motor4 = filter(motor4);
   // motor1 = motor2 = motor3 = motor4 = 0;
}
 virtual void operator()( int bits )
  { teste(bits,0.65,3515,0.35,4832) ; }
Ejemplo n.º 13
0
main()
{
  //original();
  teste();
}
Ejemplo n.º 14
0
 void execute( int bits )
  { c_.init(bits) ; teste(0.35) ;  }
 virtual void operator()( int bits ) { teste(bits,0.35) ; }
Ejemplo n.º 16
0
 void execute( int bits )
  {
   c1_.init(bits) ;
   c2_.init(bits) ;
   teste(0.65,3515,0.35,4832) ;
  }
Ejemplo n.º 17
0
StageState::StageState() : tileSet(152,76), tileMap("map/tileMap.txt", &tileSet),
moneyText("font/enhanced_dot_digital-7.ttf", 40, Text::TEXT_BLENDED, "-", WHITE, 100), occupancyMap(tileMap.GetWidth(), tileMap.GetWidth()), sheet(PERMONKEY), subGuiEdit("img/icons/door.png", "img/icons/wall.jpg"),
okTile("img/tileset/tile_grama_1.png"), noTile("img/tileset/tile_grama_2.png"),
music("music/can_o do vinho.ogg"), costText("font/Deltoid-sans.ttf", 35, Text::TEXT_BLENDED, "-", RED),
click("music/click_interface.wav"){
	cMusic = 0;
	music.Play(1);
	cout << music.isOverInd << endl;
	instance = this;
	string file, file2, tile, line, endLine("\n"), initFile("img/tileset/");
	FILE *tileFile, *objectFile;
	Point roomBegin, roomEnd;
	ifstream objFile, roomFile;
	char c;
	vector<string> objectList, roomList;

	obstacleMap = occupancyMap.Update(&tileMap, &objectArray);

	creationTimer.Restart();

	rType = CORRIDOR;

	roomBegin.SetPoint(0, 0);
	roomEnd.SetPoint(25, 25);

	action = NONE;


	bg.Open("img/fundo_espaco.png");

	//Room *newRoom = new Room(roomBegin, roomEnd, &tileMap, &objectArray, roomArray.size(), rType);
	//roomArray.emplace_back(newRoom);

	file = "img/tileset/tilelist.txt";
	tileFile = fopen(file.c_str(), "r");
    if(tileFile == NULL)
        exit(EXIT_FAILURE);

    while (!feof(tileFile)) {
        fscanf(tileFile, "%c", &c);
        line = c;
        while(line.find(endLine)== string::npos){
            fscanf(tileFile, "%c", &c);
            line = line + c;
        }

        line.pop_back();
        tile = initFile+line;
        if(tile.compare(initFile)!= 0)
            tileSet.Open(tile);
    }
	fclose(tileFile);
	cout << "Aqui inicio" << endl;
	switch (StateData::langInd){
	case 0:
		objFile.open("obj/pt-br-objects.txt");
		break;
	case 1:
		objFile.open("obj/en-objects.txt");
		break;
	}
	cout << "Aqui inicio" << endl;
	

	while (!objFile.eof()){
		getline(objFile, file);
		objectList.emplace_back(file);
	}

	
	for (int i = 0; i < objectList.size(); i++){
		cout << objectList[i] << endl;
	}

	cout << "Ended" << endl;

	ParseObject(objectList);

	roomFile.open("room/rooms.txt");

	while (!roomFile.eof()){
		getline(roomFile, file);
		roomList.emplace_back(file);
	}


	for (int i = 0; i < roomList.size(); i++){
		cout << roomList[i] << endl;
	}

	ParseRoom(roomList);

	Point monkeyTile(4, 4);
	Point teste(4, 4);
	monkeyTile = tileMap.GetTileCenter(monkeyTile);
	Permonkey* pM = new Permonkey(monkeyTile.x, monkeyTile.y, teste, tileMap, objList);
	objectArray.emplace_back(pM);

	data = new StateData();
	data->money = 5000;
	data->fame = 128;
	moneyText.SetText(to_string(data->money));
	moneyText.SetPos(20, 20, false, false);
}