diff --git a/Juego.java b/Juego.java index b69ba4e..bb7fa31 100644 --- a/Juego.java +++ b/Juego.java @@ -34,10 +34,35 @@ public class Juego { siguiente = false; System.out.println("TRIO"); } + if (siguiente && parDoble(cartas)) { + siguiente = false; + System.out.println("PAR DOBLE"); + } if (siguiente) { System.out.println("NADA"); } } + + public boolean parDoble(List cartas) { + if(comprobarPalo(cartas)<3) { + List valores = new ArrayList<>(); + for (Carta c : cartas) { + valores.add(extraer(c.valor)); + } + Collections.sort(valores); + int[] numerosArray = pasarAArray(valores); + int con = 0; + for (int i = 0; i < numerosArray.length - 1; i++) { + if (numerosArray[i] == numerosArray[i + 1]) { + con++; + if (con == 2) { + return true; + } + } + } + } + return false; + } public boolean trio(List cartas) { List valores = new ArrayList<>(); for (Carta c : cartas) { diff --git a/Main.java b/Main.java index 46929ab..81715a8 100644 --- a/Main.java +++ b/Main.java @@ -9,11 +9,11 @@ public class Main { List cartas = new ArrayList<>(); cartas = Arrays.asList( + new Carta("AH"), new Carta("QH"), - new Carta("QH"), - new Carta("QH"), + new Carta("TC"), new Carta("TS"), - new Carta("9C") + new Carta("AC") ); cartas.forEach(System.out::print); diff --git a/out/production/poker/Juego.class b/out/production/poker/Juego.class index 3fd6127..b5ebb3c 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 8496137..d227a20 100644 Binary files a/out/production/poker/Main.class and b/out/production/poker/Main.class differ