Exemplo n.º 1
0
Arquivo: game.c Projeto: jiro789/Orga2
void game_ver_si_termina(){
unsigned char ganador;
        unsigned char haybotines = 0;
        int i;
	for (i = 0; i < BOTINES_CANTIDAD; i++){
            if (botines[i][2] != 0)
                haybotines = 1;
        }
   	if (tiempo_sin_juego < MAX_SIN_CAMBIOS && haybotines){
    	return;
    }
    if(jugadores[1].puntaje < jugadores[0].puntaje){
     	ganador = 0;
        }else{
        ganador = 1;
   	/*}else{
        if(jugadores[0].puntaje < jugadores[1].puntaje){
        	ganador = 1;
        }else{
        	ganador = -1;
        }
 	}
         */}
        //NO EXISTE EL EMPATE, GANA EL JUGADOR 2 EN ESE CASO
        jugador_t jg = jugadores[ganador];
        jugador_t *jp = &jg;
        screen_stop_game_show_winner(jp);
        hlt();
	
}
Exemplo n.º 2
0
Arquivo: jugador.c Projeto: araml/OC2
// descarga 1 hueso en la cucha y actualiza el screen
void game_jugador_anotar_punto(jugador_t *j) {
    ultimo_cambio = MAX_SIN_CAMBIOS;

    j->puntos++;

    screen_pintar_puntajes();

    if (j->puntos == 999)
        screen_stop_game_show_winner(j);
}
Exemplo n.º 3
0
// termina si se agotaron los huesos o si hace tiempo que no hay ningun cambio
void game_terminar_si_es_hora(){
	int suma = 0;
	int i;	
	for (i = 0; i < ESCONDITES_CANTIDAD; i++){
		suma += escondites[i][2];
	}

	jugador_t* ganador = NULL;
	if(jugadorA.puntos > jugadorB.puntos) ganador = &jugadorA;
	else if(jugadorA.puntos < jugadorB.puntos) ganador = &jugadorB;

	if(suma == 0 || ultimo_cambio == MAX_SIN_CAMBIOS) screen_stop_game_show_winner(ganador);
}