Hook.poolCompatible

This commit is contained in:
Thibault Duplessis 2016-12-05 17:27:01 +01:00
parent 1a7789770f
commit eedf38bf69
2 changed files with 10 additions and 3 deletions

View file

@ -70,8 +70,13 @@ case class Hook(
lazy val perfType = PerfPicker.perfType(speed, realVariant, none)
def likePoolFiveO =
realMode.rated && realVariant.standard && color == "random" && clock.show == "5+0"
def randomColor = color == "random"
def poolCompatible =
realMode.rated && realVariant.standard && randomColor &&
lila.pool.PoolList.clockStringSet.contains(clock.show)
def likePoolFiveO = poolCompatible && clock.show == "5+0"
private lazy val speed = Speed(clock.some)
}

View file

@ -2,7 +2,7 @@ package lila.pool
import scala.concurrent.duration._
private object PoolList {
object PoolList {
import PoolConfig._
@ -17,6 +17,8 @@ private object PoolList {
PoolConfig(15 ++ 15, Wave(60 seconds, 16 players))
)
val clockStringSet: Set[String] = all.map(_.clock.show).toSet
private implicit class PimpedInt(self: Int) {
def ++(increment: Int) = chess.Clock(self * 60, increment)
def players = NbPlayers(self)