From 57e00f26f319e3d7032eac7a2f2d8f45f82abf91 Mon Sep 17 00:00:00 2001 From: Josebaezx Date: Sun, 1 May 2022 15:05:35 -0400 Subject: [PATCH] Scorreccion de errores menores en la visualizacion --- .idea/misc.xml | 2 +- .idea/runConfigurations.xml | 10 ++++++++++ out/production/java-e005-poker-02/Carta.class | Bin 3017 -> 0 bytes out/production/java-e005-poker-02/Juego.class | Bin 8828 -> 0 bytes out/production/java-e005-poker-02/MyClass.class | Bin 3274 -> 0 bytes src/Carta.java | 4 ---- src/Juego.java | 32 +++++++------------------------- src/MyClass.java | 2 +- 8 files changed, 19 insertions(+), 31 deletions(-) create mode 100644 .idea/runConfigurations.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 07115cd..3d3ab27 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/out/production/java-e005-poker-02/Carta.class b/out/production/java-e005-poker-02/Carta.class index 2fd278f..d01ffdc 100644 Binary files a/out/production/java-e005-poker-02/Carta.class and b/out/production/java-e005-poker-02/Carta.class differ diff --git a/out/production/java-e005-poker-02/Juego.class b/out/production/java-e005-poker-02/Juego.class index dc175c3..a526f33 100644 Binary files a/out/production/java-e005-poker-02/Juego.class and b/out/production/java-e005-poker-02/Juego.class differ diff --git a/out/production/java-e005-poker-02/MyClass.class b/out/production/java-e005-poker-02/MyClass.class index 6f15e68..bf0aed7 100644 Binary files a/out/production/java-e005-poker-02/MyClass.class and b/out/production/java-e005-poker-02/MyClass.class differ diff --git a/src/Carta.java b/src/Carta.java index 7191743..d5f9199 100644 --- a/src/Carta.java +++ b/src/Carta.java @@ -65,9 +65,6 @@ public class Carta { this.valor=String.valueOf(rand); } } - - - } public void paloAleatorio(){ @@ -88,7 +85,6 @@ public class Carta { this.palo="S"; } } - } @Override diff --git a/src/Juego.java b/src/Juego.java index 4f69fc6..156b634 100644 --- a/src/Juego.java +++ b/src/Juego.java @@ -4,6 +4,8 @@ import java.util.*; public class Juego { List valores = null; + final int MAX=3; + final int MIN=1; public Juego() { } @@ -181,7 +183,6 @@ public class Juego { //Cuatro cartas iguales (mismo valor). public boolean poker(List cartas) { - List valores = new ArrayList<>(); cantidadPalosIguales(cartas); for (Carta c : cartas) { @@ -189,7 +190,6 @@ public class Juego { } Collections.sort(valores); int counter = 0; - int numero = 0; int cantidadNumero = 0; for (int i = 1; i < 14; i++) { for (int j = 0; j < valores.size(); j++) { @@ -199,7 +199,6 @@ public class Juego { } } if (counter > cantidadNumero) { - numero = i; cantidadNumero = counter; } counter = 0; @@ -253,7 +252,6 @@ public class Juego { valores.add(convertirValorStringAInteger(c.getValor())); } Collections.sort(valores); - //valores.forEach(System.out::println); int[] valoresArry = pasarAArray(valores); for (int i = 0; i < valoresArry.length - 1; i++) { @@ -287,7 +285,6 @@ public class Juego { valores.add(convertirValorStringAInteger(c.getValor())); } Collections.sort(valores); - //valores.forEach(System.out::println); int[] valoresArry = pasarAArray(valores); for (int i = 0; i < valoresArry.length - 1; i++) { @@ -297,7 +294,6 @@ public class Juego { return false; } } - contador += valoresArry[i]; if (contador == 34 && valoresArry[0] == 1) { return true; @@ -305,9 +301,7 @@ public class Juego { } return true; } - return false; - } private int[] pasarAArray(List valores) { @@ -349,12 +343,9 @@ public class Juego { int c = 5; for (int i = 0; i < m3.length; i++) { if (i < 5) { - //m3[i]=m1[i]; cartas.add(m1[i]); } else if (i > 4) { - //m3[i]=m1[c]; cartas.add(m2[i - c]); - //c++; } } return cartas.size(); @@ -362,10 +353,8 @@ public class Juego { } public Carta[] cambiarMano1(Carta[] m1) { - int max = 3; - int min = 1; - int range = max - min + 1; - int rand = (int) (Math.random() * range) + min; + int range = MAX - MIN + 1; + int rand = (int) (Math.random() * range) + MIN; if (rand == 1) { return m1 = new Carta[]{ new Carta("AS"), @@ -388,16 +377,11 @@ public class Juego { new Carta("TC"), new Carta("JS")}; } - - } - public Carta[] cambiarMano2(Carta[] m2) { - int max = 3; - int min = 1; - int range = max - min + 1; - int rand = (int) (Math.random() * range) + min; + int range = MAX - MIN + 1; + int rand = (int) (Math.random() * range) + MIN; if (rand == 1) { return m2 = new Carta[]{ new Carta("AK"), @@ -416,12 +400,10 @@ public class Juego { return m2 = new Carta[]{ new Carta("TH"), new Carta("9C"), - new Carta("5"), + new Carta("5D"), new Carta("TH"), new Carta("JH")}; } - - } } diff --git a/src/MyClass.java b/src/MyClass.java index af1de65..4bc5eee 100644 --- a/src/MyClass.java +++ b/src/MyClass.java @@ -38,7 +38,7 @@ public class MyClass { m2[3] = new Carta(); m2[4] = new Carta(); - System.out.println(j.isRepetidos(m1,m2)); + //System.out.println(j.isRepetidos(m1,m2)); if(j.isRepetidos(m1,m2) < 10){ m1=j.cambiarMano1(m1); m2=j.cambiarMano2(m2); -- libgit2 0.26.0