Commit d69ced50 by Yannine Alvarez

Agregar la funciòn verificar las cartas para ganador

parent c7f9007f
...@@ -135,10 +135,10 @@ ...@@ -135,10 +135,10 @@
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state x="413" y="109" key="#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog/0.0.1366.728@0.0.1366.728" timestamp="1586915044775" /> <state x="413" y="109" key="#com.intellij.refactoring.typeMigration.ui.FailedConversionsDialog/0.0.1366.728@0.0.1366.728" timestamp="1586915044775" />
<state x="313" y="0" key="CommitChangelistDialog2" timestamp="1587433848146"> <state x="313" y="0" key="CommitChangelistDialog2" timestamp="1587434440282">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state x="313" y="0" key="CommitChangelistDialog2/0.0.1366.728@0.0.1366.728" timestamp="1587433848146" /> <state x="313" y="0" key="CommitChangelistDialog2/0.0.1366.728@0.0.1366.728" timestamp="1587434440282" />
<state width="1322" height="145" key="GridCell.Tab.0.bottom" timestamp="1587433392572"> <state width="1322" height="145" key="GridCell.Tab.0.bottom" timestamp="1587433392572">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
...@@ -171,10 +171,10 @@ ...@@ -171,10 +171,10 @@
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state width="1322" height="217" key="GridCell.Tab.1.right/0.0.1366.728@0.0.1366.728" timestamp="1587426755633" /> <state width="1322" height="217" key="GridCell.Tab.1.right/0.0.1366.728@0.0.1366.728" timestamp="1587426755633" />
<state x="275" y="95" key="Vcs.Push.Dialog.v2" timestamp="1587433858527"> <state x="275" y="95" key="Vcs.Push.Dialog.v2" timestamp="1587434462567">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state x="275" y="95" key="Vcs.Push.Dialog.v2/0.0.1366.728@0.0.1366.728" timestamp="1587433858527" /> <state x="275" y="95" key="Vcs.Push.Dialog.v2/0.0.1366.728@0.0.1366.728" timestamp="1587434462567" />
<state x="92" y="92" width="1182" height="544" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1587430678418"> <state x="92" y="92" width="1182" height="544" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1587430678418">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
......
...@@ -54,21 +54,20 @@ class OrdenarCartas { ...@@ -54,21 +54,20 @@ class OrdenarCartas {
fun esAnterior(carta1: Carta, carta2: Carta): Boolean { fun esAnterior(carta1: Carta, carta2: Carta): Boolean {
var valor1 = 0 var valor1 = 0
var valor2 = 0 var valor2 = 0
//Buscamos la posicion del valor de la otra carta
for (i in valores.indices) { for (i in valores.indices) {
if (carta1.valorPalo()[0] == valores[i]) { if (carta1.valorPalo()[0] == valores[i]) {
valor1 = i valor1 = i
break break
} }
} }
//Buscamos la posicion del valor de esta carta
for (i in valores.indices) { for (i in valores.indices) {
if (carta2.valorPalo()[0] == valores[i]) { if (carta2.valorPalo()[0] == valores[i]) {
valor2 = i valor2 = i
break break
} }
} }
//averiguamos si es el siguiente
return if (valor1 != valor2 + 1) { return if (valor1 != valor2 + 1) {
false false
} else true } else true
......
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