Funciona sala

This commit is contained in:
Guillermo Roche 2019-12-12 20:43:47 +01:00
parent 76c725081a
commit 2b3212d7df

View File

@ -17,15 +17,42 @@ public class Main {
BufferedReader bufferEntrada = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedReader bufferEntrada = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter bufferSalida = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()),true); PrintWriter bufferSalida = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()),true);
String entrada = bufferEntrada.readLine(); String entrada = bufferEntrada.readLine();
while(!entrada.equals("final")) { while(!entrada.equals("fin")) {
System.out.println(entrada);
entrada = bufferEntrada.readLine();
}
System.out.println("Introduce el numero de partida en el que quieres entrar");
bufferSalida.println(es.nextLine());
System.out.println(bufferEntrada.readLine());
System.out.println(bufferEntrada.readLine());
System.out.println(bufferEntrada.readLine());
while(dibujarTablero(bufferEntrada)) {
System.out.println("introduce la x de la nueva marca");
bufferSalida.println(es.nextLine());
System.out.println("introduce la y de la nueva marca");
bufferSalida.println(es.nextLine());
} }
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
}
static boolean dibujarTablero(BufferedReader entrada) throws IOException {
for(int i = 0; i < 3; i++) {
String linea = entrada.readLine();
if(linea.length() == 1) {
if(linea.equals("v")) {
System.out.println("Has ganado!");
}else {
System.out.println("Has perdido...");
}
return false;
} else {
System.out.println(linea);
}
}
return true;
} }
} }