remind the AI to play on page reload
parent
64bf53e146
commit
71bd5d2410
|
@ -41,6 +41,7 @@ object Round extends LilaController with TheftPrevention {
|
|||
|
||||
def player(fullId: String) = Open { implicit ctx ⇒
|
||||
OptionFuResult(GameRepo pov fullId) { pov ⇒
|
||||
if (pov.game.playableByAi) env.roundMap ! Tell(pov.game.id, AiPlay(_ ⇒ ()))
|
||||
pov.game.started.fold(
|
||||
PreventTheft(pov) {
|
||||
(pov.game.hasChat optionFu {
|
||||
|
|
|
@ -196,6 +196,8 @@ case class Game(
|
|||
|
||||
def playableBy(c: Color): Boolean = playableBy(player(c))
|
||||
|
||||
def playableByAi: Boolean = playable && player.isAi
|
||||
|
||||
def continuable = status != Status.Mate && status != Status.Stalemate
|
||||
|
||||
def fenString = Forsyth >> toChess
|
||||
|
|
|
@ -32,8 +32,7 @@ private[round] final class Player(
|
|||
notifyProgress(progress) >>
|
||||
progress.game.finished.fold(
|
||||
moveFinish(progress.game, color) map { progress.events ::: _ }, {
|
||||
if (progress.game.player.isAi && progress.game.playable)
|
||||
roundMap ! Tell(game.id, AiPlay(onFailure))
|
||||
if (progress.game.playableByAi) roundMap ! Tell(game.id, AiPlay(onFailure))
|
||||
fuccess(progress.events)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue