Terminadas funciones en yaku10.kt

master
Araozu 2020-10-21 07:04:32 -05:00
parent 3f22a5ce3d
commit bfb91ce6a5
3 changed files with 32 additions and 2 deletions

View File

@ -24,6 +24,9 @@ sealed class Carta(val valor: Int) {
fun esCartaVerde() =
valor == 128 || valor == 192 || valor == 224 || valor == 256
fun esDragonORey() =
valor == 64 || valor == 96 || valor == 128 || valor == 160 || valor == 192 || valor == 224 || valor == 256
}
sealed class CartaNumero(valor: Int, val numero: Int = (valor shl 27) ushr 28) : Carta(valor) {

View File

@ -1,13 +1,40 @@
package dev.araozu.juego.yaku
import dev.araozu.juego.CartaRealeza
import dev.araozu.juego.ContenedorGrupos
internal fun yakuRealezaDragones(contenedorGrupos: ContenedorGrupos): Boolean {
return false
for (carrl in contenedorGrupos.seqs) {
for (c in carrl) {
if (!c.esDragonORey()) return false
}
}
for (carrl in contenedorGrupos.tris) {
for (c in carrl) {
if (!c.esDragonORey()) return false
}
}
for (carrl in contenedorGrupos.pares) {
for (c in carrl) {
if (!c.esDragonORey()) return false
}
}
return true
}
internal fun yakuRealezaFull(contenedorGrupos: ContenedorGrupos): Boolean {
if (contenedorGrupos.tris.size != 3) return false
for (carrl in contenedorGrupos.tris) {
for (c in carrl) {
if (c !is CartaRealeza) return false
}
}
return false
}

View File

@ -23,7 +23,7 @@ internal fun yakuDragonesFull(contenedorGrupos: ContenedorGrupos): Boolean {
}
}
return false
return true
}
internal fun yakuVerde(contenedorGrupos: ContenedorGrupos): Boolean {