remind the AI to play on page reload

pull/83/head
Thibault Duplessis 2013-05-18 16:14:57 -03:00
parent 64bf53e146
commit 71bd5d2410
3 changed files with 4 additions and 2 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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)
})
})