From d69ced5034f864b20cb772942a8c218fc1874eac Mon Sep 17 00:00:00 2001 From: Yannine Alvarez Date: Mon, 20 Apr 2020 22:02:53 -0400 Subject: [PATCH] Agregar la funciĆ²n verificar las cartas para ganador --- Poker/.idea/workspace.xml | 8 ++++---- Poker/src/Poker.kt | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Poker/.idea/workspace.xml b/Poker/.idea/workspace.xml index e37090e..e67dd85 100644 --- a/Poker/.idea/workspace.xml +++ b/Poker/.idea/workspace.xml @@ -135,10 +135,10 @@ - + - + @@ -171,10 +171,10 @@ - + - + diff --git a/Poker/src/Poker.kt b/Poker/src/Poker.kt index 2893761..475187a 100644 --- a/Poker/src/Poker.kt +++ b/Poker/src/Poker.kt @@ -54,21 +54,20 @@ class OrdenarCartas { fun esAnterior(carta1: Carta, carta2: Carta): Boolean { var valor1 = 0 var valor2 = 0 - //Buscamos la posicion del valor de la otra carta + for (i in valores.indices) { if (carta1.valorPalo()[0] == valores[i]) { valor1 = i break } } - //Buscamos la posicion del valor de esta carta + for (i in valores.indices) { if (carta2.valorPalo()[0] == valores[i]) { valor2 = i break } } - //averiguamos si es el siguiente return if (valor1 != valor2 + 1) { false } else true -- libgit2 0.26.0