text stringlengths 0 2.87M |
|---|
if (turno == 'X') { |
moverJugador(); |
} else { |
moverIA(); |
} |
if (hayGanador(turno)) { |
mostrarTablero(); |
System.out.println("El ganador es " + turno + "."); |
break; |
} |
if (tableroLleno()) { |
System.out.println("Empate."); |
break; |
} |
cambiarTurno(); |
} |
reiniciarTablero(); |
} |
public static void moverJugador() { |
System.out.print("Fila (1, 2, o 3): "); |
fila = scan.nextInt() - 1; |
System.out.print("Columna (1, 2, o 3): "); |
columna = scan.nextInt() - 1; |
while (tablero[fila][columna] != ' ') { |
System.out.println("Esa casilla ya está ocupada. Intenta de nuevo."); |
System.out.print("Fila (1, 2, o 3): "); |
fila = scan.nextInt() - 1; |
System.out.print("Columna (1, 2, o 3): "); |
columna = scan.nextInt() - 1; |
} |
tablero[fila][columna] = turno; |
} |
public static void moverIA() { |
fila = (int) (Math.random() * 3); |
columna = (int) (Math.random() * 3); |
while (tablero[fila][columna] != ' ') { |
fila = (int) (Math.random() * 3); |
columna = (int) (Math.random() * 3); |
} |
tablero[fila][columna] = turno; |
} |
public static boolean hayGanador(char jugador) { |
for (int i = 0; i < 3; i++) { |
if (tablero[i][0] == jugador && tablero[i][1] == jugador && tablero[i][2] == jugador) { |
return true; |
} |
if (tablero[0][i] == jugador && tablero[1][i] == jugador && tablero[2][i] == jugador) { |
return true; |
} |
} |
if (tablero[0][0] == jugador && tablero[1][1] == jugador && tablero[2][2] == jugador) { |
return true; |
} |
if (tablero[0][2] == jugador && tablero[1][1] == jugador && tablero[2][0] == jugador) { |
return true; |
} |
return false; |
} |
public static boolean tableroLleno() { |
for (int i = 0; i < 3; i++) { |
for (int j = 0; j < 3; j++) { |
if (tablero[i][j] == ' ') { |
return false; |
} |
} |
} |
return true; |
} |
public static void cambiarTurno() { |
if (turno == 'X') { |
turno = 'O'; |
} else { |
turno = 'X'; |
} |
} |
public static void mostrarTablero() { |
System.out.println("-------------"); |
for (int i = 0; i < 3; i++) { |
System.out.print("| "); |
for (int j = 0; j < 3; j++) { |
System.out.print(tablero[i][j] + " | "); |
} |
System.out.println(); |
System.out.println("-------------"); |
} |
} |
}<kinrel><user>Como puedo de subir de clasificación en lol?<user><kinrel>Si quieres subir de clasificación en League of Legends (LoL), aquí hay algunos consejos que puedes seguir: |
Aprende a jugar de manera efectiva con varios personajes y comprende sus fortalezas y debilidades. Esto te permitirá ser más versátil en el campo de batalla y ajustarte a las necesidades de tu equipo en tiempo real. |
Practica y mejora tus habilidades individuales, como farmear, rotar, objetivos y coordinación con tus compañeros de equipo. |
Mantén una mentalidad positiva y aprende a trabajar en equipo. La comunicación y la colaboración son clave para el éxito en LoL. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.