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/Juego.java b/Juego.java index 77b4069..10fd890 100644 --- a/Juego.java +++ b/Juego.java @@ -31,10 +31,44 @@ public class Juego { siguiente = false; System.out.println("COLOR"); } + if (siguiente && trio(cartas)) { + siguiente = false; + System.out.println("TRIO"); + } if (siguiente) { System.out.println("NADA"); } } + public boolean trio(List cartas) { + List valores = new ArrayList<>(); + for (Carta c : cartas) { + valores.add(extraer(c.valor)); + } + //Collections.sort(valores); + int counter=0; + int numero=0; + int cantidadNumero=0; + for(int i=11; i<14; i++){ + for (int j=0; j cantidadNumero){ + numero=i; + cantidadNumero=counter; + } + counter=0; + } + + if (cantidadNumero==3){ + return true; + }else { + return false; + } + } + //Dos cartas iguales (mismo valor) junto con tres cartas iguales (mismo valor). public boolean full(List cartas) { List valores = new ArrayList<>(); diff --git a/Main.java b/Main.java index a2ba5bc..ff13b8d 100644 --- a/Main.java +++ b/Main.java @@ -9,11 +9,11 @@ public class Main { List cartas = new ArrayList<>(); cartas = Arrays.asList( - new Carta("2H"), - new Carta("2H"), - new Carta("7H"), - new Carta("7S"), - new Carta("7H") + new Carta("QH"), + new Carta("QH"), + new Carta("QH"), + new Carta("5S"), + new Carta("9C") ); cartas.forEach(System.out::print); diff --git a/out/production/poker/.idea/runConfigurations.xml b/out/production/poker/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/out/production/poker/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/out/production/poker/Juego.class b/out/production/poker/Juego.class index 779ce8d..111c346 100644 Binary files a/out/production/poker/Juego.class and b/out/production/poker/Juego.class differ diff --git a/out/production/poker/Main.class b/out/production/poker/Main.class index 5ba3b32..03cd4e9 100644 Binary files a/out/production/poker/Main.class and b/out/production/poker/Main.class differ