add bot lag vs AI
This commit is contained in:
parent
7d033e37be
commit
b1c9ab7012
|
@ -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)()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue