add bot lag vs AI

This commit is contained in:
Thibault Duplessis 2018-05-10 17:58:39 +02:00
parent 7d033e37be
commit b1c9ab7012
2 changed files with 13 additions and 13 deletions

View file

@ -13,11 +13,11 @@ import lila.user.User
final class BotPlayer(
roundMap: ActorSelection,
chatActor: ActorSelection,
system: ActorSystem
) {
chatActor: ActorSelection
)(implicit system: ActorSystem) {
def apply(pov: Pov, me: User, uciStr: String): Funit =
lila.common.Future.delay((pov.game.hasAi ?? 500) millis) {
Uci(uciStr).fold(fufail[Unit](s"Invalid UCI: $uciStr")) { uci =>
lila.mon.bot.moves(me.username)()
if (!pov.isMyTurn) fufail("Not your turn, or game already over")
@ -27,6 +27,7 @@ final class BotPlayer(
promise.future
}
}
}
def chat(gameId: Game.ID, me: User, d: BotForm.ChatData) = fuccess {
lila.mon.bot.chats(me.username)()

View file

@ -19,9 +19,8 @@ final class Env(
lazy val player = new BotPlayer(
roundMap = hub.actor.roundMap,
chatActor = hub.actor.chat,
system = system
)
chatActor = hub.actor.chat
)(system)
val form = BotForm
}