InicioJuego.java 1.71 KB
Newer Older
roshka committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
import java.util.Scanner;


public class InicioJuego{
    public static void main(String[] args) {
        //Creamos las herramientas necesarias para el juego
        Juego juego = new Juego();
        String nombre1,nombre2;
        Scanner teclado = new Scanner(System.in);
        Tablero tabla = new Tablero();
        Html dibujarTablaHtml = new Html();
        //Preparamos para escribir las lineas del juego
        dibujarTablaHtml.introHtml();
        dibujarTablaHtml.preparacionEscribirLineaJuego();
        //Iniciamos el juego
        System.out.println("Bienvenido al Tateti");
        System.out.println("Por favor, ingrese el nombre del jugador 1");
        nombre1 = teclado.nextLine();
        System.out.println("Por favor, ingrese el nombre del jugador 2");
        nombre2 = teclado.nextLine();
        System.out.println("Ok " + nombre1 + " y " + nombre2 + ", vamos a jugar.");
        //Preparamos el tablero
        tabla.imprimirTableroVacio();
        char resultado = juego.aJugar(nombre1,nombre2);
        //Imprimir en pantalla al ganador
        if(resultado == 'e'){
            System.out.println("Nadie gano");
                dibujarTablaHtml.escribirLineaJuego("Nadie gano");
        }else if(resultado == 'O'){
            System.out.println("El ganador es: "+nombre1);
                dibujarTablaHtml.escribirLineaJuego("El ganador es: "+nombre1);
        }else{
            System.out.println("El ganador es: "+nombre2);
                dibujarTablaHtml.escribirLineaJuego("El ganador es: "+nombre2);
        }
        System.out.println("Fin del juego");
            dibujarTablaHtml.escribirLineaJuego("Fin del juego");
        dibujarTablaHtml.cerrarHtml();
    }



}