Arreglados errores menores
This commit is contained in:
		
							parent
							
								
									cb3b2e3882
								
							
						
					
					
						commit
						ebd75911fc
					
				| @ -75,6 +75,7 @@ public class ComunacacionJugador extends Thread{ | |||||||
| 				continuar = false; | 				continuar = false; | ||||||
| 				if(finalJuego == jugador) { | 				if(finalJuego == jugador) { | ||||||
| 					bufferSalida.println("v"); | 					bufferSalida.println("v"); | ||||||
|  | 					Servidor.salas3.remove(sala); | ||||||
| 				}else { | 				}else { | ||||||
| 					bufferSalida.println("f"); | 					bufferSalida.println("f"); | ||||||
| 				} | 				} | ||||||
| @ -94,7 +95,7 @@ public class ComunacacionJugador extends Thread{ | |||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
| 		} | 		} | ||||||
| 		Servidor.salas3.remove(sala); | 		 | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void partida4(BufferedReader bufferEntrada, PrintWriter bufferSalida, int sala) throws InterruptedException, NumberFormatException, IOException { | 	private void partida4(BufferedReader bufferEntrada, PrintWriter bufferSalida, int sala) throws InterruptedException, NumberFormatException, IOException { | ||||||
| @ -131,6 +132,7 @@ public class ComunacacionJugador extends Thread{ | |||||||
| 				continuar = false; | 				continuar = false; | ||||||
| 				if(finalJuego == jugador) { | 				if(finalJuego == jugador) { | ||||||
| 					bufferSalida.println("v"); | 					bufferSalida.println("v"); | ||||||
|  | 					Servidor.salas4.remove(sala); | ||||||
| 				}else { | 				}else { | ||||||
| 					bufferSalida.println("f"); | 					bufferSalida.println("f"); | ||||||
| 				} | 				} | ||||||
| @ -149,6 +151,6 @@ public class ComunacacionJugador extends Thread{ | |||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
| 		} | 		} | ||||||
| 		Servidor.salas4.remove(sala); | 		 | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -50,15 +50,15 @@ public class Servidor { | |||||||
| 	 | 	 | ||||||
| 	public static boolean addJugador(int sala, Socket socket) { | 	public static boolean addJugador(int sala, Socket socket) { | ||||||
| 		boolean ret = false; | 		boolean ret = false; | ||||||
| 		if(sala == Servidor.salas3.size()-1) { | 		if(sala < Servidor.salas3.size()) { | ||||||
| 			ret = Servidor.salas3.get(sala).aniadirJugador(socket); | 			ret = Servidor.salas3.get(sala).aniadirJugador(socket); | ||||||
| 			if(Servidor.salas3.get(sala).nJugadores==1) { | 			if(Servidor.salas3.get(sala).nJugadores==1) { | ||||||
| 				Servidor.salas3.add(new Sala3()); | 				Servidor.salas3.add(new Sala3()); | ||||||
| 			} | 			} | ||||||
| 		}else if(sala == (Servidor.salas4.size()+Servidor.salas3.size()-1)) { | 		}else if(sala < (Servidor.salas4.size()+Servidor.salas3.size())) { | ||||||
| 			ret = Servidor.salas4.get(sala-Servidor.salas3.size()).aniadirJugador(socket); | 			ret = Servidor.salas4.get(sala-Servidor.salas3.size()).aniadirJugador(socket); | ||||||
| 			if(Servidor.salas3.get(sala).nJugadores==1) { | 			if(Servidor.salas4.get(sala-Servidor.salas3.size()).nJugadores==1) { | ||||||
| 				Servidor.salas3.add(new Sala3()); | 				Servidor.salas4.add(new Sala4()); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ public class Tablero4 { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public boolean colocarFicha(int x, int jugador) { | 	public boolean colocarFicha(int x, int jugador) { | ||||||
| 		if(this.casillas[x][6] == 0) { | 		if(this.casillas[x][5] == 0) { | ||||||
| 			for(int i = 0;i < this.casillas[x].length; i++) { | 			for(int i = 0;i < this.casillas[x].length; i++) { | ||||||
| 				if(this.casillas[x][i] == 0) { | 				if(this.casillas[x][i] == 0) { | ||||||
| 					this.casillas[x][i] = jugador; | 					this.casillas[x][i] = jugador; | ||||||
| @ -33,9 +33,9 @@ public class Tablero4 { | |||||||
| 	 | 	 | ||||||
| 	public String getTablero() { | 	public String getTablero() { | ||||||
| 		String ret = ""; | 		String ret = ""; | ||||||
| 		for(int i = 0; i< this.casillas.length; i++) { | 		for(int i = this.casillas[0].length-1; i >= 0; i--) { | ||||||
| 			for(int j = 0; j < this.casillas[i].length; j++) { | 			for(int j = 0; j < this.casillas.length; j++) { | ||||||
| 				ret += this.casillas[i][j] + " "; | 				ret += this.casillas[j][i] + " "; | ||||||
| 			} | 			} | ||||||
| 			if(i != this.casillas.length-1) { | 			if(i != this.casillas.length-1) { | ||||||
| 				ret += "\n"; | 				ret += "\n"; | ||||||
| @ -49,16 +49,16 @@ public class Tablero4 { | |||||||
|         int ret=0; |         int ret=0; | ||||||
|         for(int i = 0;i < this.casillas.length-1; i++) { |         for(int i = 0;i < this.casillas.length-1; i++) { | ||||||
| 			for(int j = 0;j < this.casillas[i].length; j++) { | 			for(int j = 0;j < this.casillas[i].length; j++) { | ||||||
| 				if(comprobarHorizontal(i, j, this.casillas[i][j]) <= 4) { | 				if(comprobarHorizontal(i, j, this.casillas[i][j]) >= 3) { | ||||||
| 					return this.casillas[i][j]; | 					return this.casillas[i][j]; | ||||||
| 				} | 				} | ||||||
| 				if(comprobarVertical(i, j, this.casillas[i][j]) <= 4) { | 				if(comprobarVertical(i, j, this.casillas[i][j]) >= 3) { | ||||||
| 					return this.casillas[i][j]; | 					return this.casillas[i][j]; | ||||||
| 				} | 				} | ||||||
| 				if(comprobarDiagonalArriba(i, j, this.casillas[i][j]) <= 4) { | 				if(comprobarDiagonalArriba(i, j, this.casillas[i][j]) >= 3) { | ||||||
| 					return this.casillas[i][j]; | 					return this.casillas[i][j]; | ||||||
| 				} | 				} | ||||||
| 				if(comprobarDiagonalAbajo(i, j, this.casillas[i][j]) <= 4) { | 				if(comprobarDiagonalAbajo(i, j, this.casillas[i][j]) >= 3) { | ||||||
| 					return this.casillas[i][j]; | 					return this.casillas[i][j]; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user