Commit 57e00f26 by Josebaezx

Scorreccion de errores menores en la visualizacion

parent 7fe40518
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
......@@ -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
......
......@@ -4,6 +4,8 @@ import java.util.*;
public class Juego {
List<Integer> 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<Carta> cartas) {
List<Integer> 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<Integer> 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")};
}
}
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment