Agregada funcion para verificar si una carta es de color verde

This commit is contained in:
Araozu 2020-10-20 21:58:36 -05:00
parent 658cce263a
commit 7ae3231493
2 changed files with 9 additions and 4 deletions

View File

@ -7,10 +7,10 @@ import kotlinx.coroutines.isActive
object GestorJuegos {
private val todasCartas = arrayOf(
34, 34, 2, 2, 35, 35, 3, 3, 36, 36, 4, 4, 37, 37, 5, 5, 38, 38, 6, 6, 39, 39, 7, 7, 40, 40, 8, 8, 41,
41, 9, 9, 42, 42, 10, 10, 43, 43, 11, 11, 44, 44, 12, 12, 45, 45, 13, 13, 46, 46, 14, 14, 47, 47, 15, 15, 48,
48, 16, 16, 49, 49, 17, 17, 50, 50, 18, 18, 51, 51, 19, 19, 52, 52, 20, 20, 53, 53, 21, 21, 64, 64, 64, 64, 96,
96, 96, 96, 128, 128, 128, 128, 160, 160, 160, 160, 192, 224, 256, 192, 224, 256, 192, 224, 256, 192, 224, 256
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
18, 18, 19, 19, 20, 20, 21, 21, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43,
44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 64, 64, 64, 64, 96, 96, 96, 96,
128, 128, 128, 128, 160, 160, 160, 160, 192, 192, 192, 192, 224, 224, 224, 224, 256, 256, 256, 256
)
private val letras = arrayOf(

View File

@ -19,6 +19,11 @@ sealed class Carta(val valor: Int) {
}
}
}
// Cartas de color verde: 128, 192, 224, 256
fun esCartaVerde() =
valor == 128 || valor == 192 || valor == 224 || valor == 256
}
sealed class CartaNumero(valor: Int, val numero: Int = (valor shl 27) ushr 28) : Carta(valor) {