Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 19, 2021 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/c437760dcc0b8f159935f0a37059007e to your computer and use it in GitHub Desktop.
Save parzibyte/c437760dcc0b8f159935f0a37059007e to your computer and use it in GitHub Desktop.
char solicitar_jugador() {
char jugador = ARQUERO_J1;
while (1) {
printf("%c - Arquero 1\n%c - Arquero 2. Seleccione quien empieza la partida: ", ARQUERO_J1, ARQUERO_J2);
scanf("%c", &jugador);
consumir_nueva_linea();
if (jugador == ARQUERO_J1 || jugador == ARQUERO_J2) {
return jugador;
} else {
printf("Jugador incorrecto\n");
}
}
}
char solicitar_eleccion(char jugador) {
char eleccion = ' ';
while (1) {
printf("%c - Mover\n%c - Disparar. Jugador %c seleccione una opcion: ", OPCION_MOVER, OPCION_DISPARAR, jugador);
scanf("%c", &eleccion);
consumir_nueva_linea();
if (eleccion == OPCION_MOVER || eleccion == OPCION_DISPARAR) {
return eleccion;
} else {
printf("La opcion no es correcta\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment