From 65dd487c76f6d84f3ca7464438fe18b881d3fd18 Mon Sep 17 00:00:00 2001 From: JoseBaezx Date: Tue, 26 Apr 2022 17:32:09 -0400 Subject: [PATCH] Se agrega metodo color --- Juego.java | 24 +++++++++++++++++++----- Main.java | 10 +++++----- out/production/poker/Juego.class | Bin 4198 -> 0 bytes out/production/poker/Main.class | Bin 2176 -> 0 bytes 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Juego.java b/Juego.java index 547c07b..daa39d8 100644 --- a/Juego.java +++ b/Juego.java @@ -16,10 +16,27 @@ public class Juego { System.out.println("ESCALERA COLOR"); } if(siguiente && escalera(cartas)){ + siguiente =false; System.out.println("ESCALERA"); } + if(siguiente && color(cartas)){ + siguiente =false; + System.out.println("COLOR"); + } + if(siguiente){ + System.out.println("NADA"); + } } + public boolean color(List cartas) { + String valuePalo = estraerPalo(cartas); + for (int i = 0; i < cartas.size(); i++) { + if (!valuePalo.equals(cartas.get(i).palo)) { + return false; + } + } + return true; + } public boolean escalera(List cartas) { int contador = 0; List valores = new ArrayList<>(); @@ -36,8 +53,6 @@ public class Juego { if (valoresArry[i] > 1) { if (valoresArry[i + 1] - valoresArry[i] != 1) { return false; - } else { - return true; } } @@ -46,7 +61,7 @@ public class Juego { return true; } } - return false; + return true; } public boolean escaleraColor(List cartas) { @@ -72,8 +87,6 @@ public class Juego { if (valoresArry[i] > 1) { if (valoresArry[i + 1] - valoresArry[i] != 1) { return false; - } else { - return true; } } @@ -82,6 +95,7 @@ public class Juego { return true; } } + return true; } return false; diff --git a/Main.java b/Main.java index f39b1f9..c4e27ec 100644 --- a/Main.java +++ b/Main.java @@ -9,11 +9,11 @@ public class Main { List cartas = new ArrayList<>(); cartas = Arrays.asList( - new Carta("7H"), - new Carta("8H"), - new Carta("9H"), - new Carta("JH"), - new Carta("TH") + new Carta("2H"), + new Carta("3H"), + new Carta("4H"), + new Carta("5H"), + new Carta("6H") ); cartas.forEach(System.out::print); diff --git a/out/production/poker/Juego.class b/out/production/poker/Juego.class index 113997e..cddfa54 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 65542ef..da08b12 100644 Binary files a/out/production/poker/Main.class and b/out/production/poker/Main.class differ -- libgit2 0.26.0