Aniadido soporte 4 en raya

This commit is contained in:
2019-12-14 21:35:59 +01:00
parent cf9dc54b5c
commit cb3b2e3882
6 changed files with 314 additions and 68 deletions

36
src/Sala4.java Normal file
View File

@@ -0,0 +1,36 @@
import java.net.Socket;
public class Sala4 {
int nJugadores;
Socket[] jugadores;
Tablero4 tablero;
public Sala4() {
this.nJugadores = 0;
this.jugadores = new Socket[2];
this.tablero = new Tablero4();
}
public boolean aniadirJugador(Socket jugador) {
if(this.nJugadores <= 1 ) {
this.jugadores[this.nJugadores] = jugador;
this.nJugadores++;
return true;
}else {
return false;
}
}
public Socket getJugador1() {
return this.jugadores[0];
}
public Socket getJugador2() {
return this.jugadores[1];
}
public String toString() {
return String.valueOf(this.nJugadores) + "Cuatro en raya";
}
}