real AI rematch
This commit is contained in:
parent
affcbec754
commit
fa0f03eb35
|
@ -31,7 +31,7 @@
|
|||
}
|
||||
}
|
||||
} else {
|
||||
<a class="button" title="@trans.playWithTheSameOpponentAgain()" href="@routes.Lobby.home()#ai">@trans.rematch()</a>
|
||||
<a class="lichess_rematch button socket-link" title="@trans.playWithTheSameOpponentAgain()" data-msg="rematch-yes">@trans.rematch()</a>
|
||||
}
|
||||
<a class="lichess_new_game button" title="@trans.playWithAnotherOpponent()" href="@routes.Lobby.home()">@trans.newOpponent()</a>
|
||||
}
|
||||
|
|
|
@ -222,7 +222,6 @@ case class Game(
|
|||
def playerCanRematch(color: Color) =
|
||||
!player(color).isOfferingRematch &&
|
||||
finishedOrAborted &&
|
||||
opponent(color).isHuman &&
|
||||
nonTournament
|
||||
|
||||
def playerCanProposeTakeback(color: Color) =
|
||||
|
@ -388,7 +387,6 @@ object Game {
|
|||
game: ChessGame,
|
||||
whitePlayer: Player,
|
||||
blackPlayer: Player,
|
||||
ai: Option[(Color, Int)],
|
||||
creatorColor: Color,
|
||||
mode: Mode,
|
||||
variant: Variant,
|
||||
|
|
|
@ -48,7 +48,6 @@ private[importer] case class ImportData(pgn: String) {
|
|||
|
||||
val dbGame = Game.make(
|
||||
game = ChessGame(board = initBoard | (Board init variant)),
|
||||
ai = None,
|
||||
whitePlayer = Player.white withName name(_.White, _.WhiteElo),
|
||||
blackPlayer = Player.black withName name(_.Black, _.BlackElo),
|
||||
creatorColor = Color.White,
|
||||
|
|
|
@ -42,7 +42,6 @@ private[lobby] final class Biter(
|
|||
},
|
||||
none)
|
||||
),
|
||||
ai = None,
|
||||
whitePlayer = Player.white,
|
||||
blackPlayer = Player.black,
|
||||
creatorColor = hook.realColor.resolve,
|
||||
|
|
|
@ -18,7 +18,7 @@ private[round] final class Rematcher(
|
|||
|
||||
def yes(pov: Pov): Fu[Events] = pov match {
|
||||
case Pov(game, color) if (game playerCanRematch color) ⇒
|
||||
game.opponent(color).isOfferingRematch.fold(
|
||||
(game.opponent(color).isOfferingRematch || game.opponent(color).isAi).fold(
|
||||
game.next.fold(rematchJoin(pov))(rematchExists(pov)),
|
||||
rematchCreate(pov)
|
||||
)
|
||||
|
@ -88,7 +88,6 @@ private[round] final class Rematcher(
|
|||
clock = pov.game.clock map (_.reset)),
|
||||
whitePlayer = whitePlayer,
|
||||
blackPlayer = blackPlayer,
|
||||
ai = None,
|
||||
creatorColor = !pov.color,
|
||||
mode = pov.game.mode,
|
||||
variant = pov.game.variant,
|
||||
|
@ -96,7 +95,7 @@ private[round] final class Rematcher(
|
|||
pgnImport = None) with960Rematch !pov.game.is960Rematch
|
||||
|
||||
private def returnPlayer(game: Game, color: ChessColor): Fu[lila.game.Player] =
|
||||
lila.game.Player.make(color = color, aiLevel = None) |> { player ⇒
|
||||
lila.game.Player.make(color = color, aiLevel = game.opponent(color).aiLevel) |> { player ⇒
|
||||
game.player(!color).userId.fold(fuccess(player)) { userId ⇒
|
||||
UserRepo byId userId map { _.fold(player)(player.withUser) }
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ case class AiConfig(
|
|||
def game = fenGame { chessGame ⇒
|
||||
Game.make(
|
||||
game = chessGame,
|
||||
ai = Some(!creatorColor -> level),
|
||||
whitePlayer = Player.make(
|
||||
color = ChessColor.White,
|
||||
aiLevel = creatorColor.black option level),
|
||||
|
|
|
@ -16,7 +16,6 @@ private[setup] case object ApiConfig extends Config with GameGenerator {
|
|||
|
||||
def game = Game.make(
|
||||
game = makeGame,
|
||||
ai = None,
|
||||
whitePlayer = Player.white,
|
||||
blackPlayer = Player.black,
|
||||
creatorColor = creatorColor,
|
||||
|
|
|
@ -19,7 +19,6 @@ case class FriendConfig(
|
|||
def game = fenGame { chessGame ⇒
|
||||
Game.make(
|
||||
game = chessGame,
|
||||
ai = None,
|
||||
whitePlayer = Player.white,
|
||||
blackPlayer = Player.black,
|
||||
creatorColor = creatorColor,
|
||||
|
|
|
@ -25,7 +25,6 @@ final class GameJoiner(
|
|||
board = chess.Board init tour.variant,
|
||||
clock = tour.clock.chessClock.some
|
||||
),
|
||||
ai = None,
|
||||
whitePlayer = GamePlayer.white withUser user1,
|
||||
blackPlayer = GamePlayer.black withUser user2,
|
||||
creatorColor = chess.Color.White,
|
||||
|
|
3
todo
3
todo
|
@ -61,14 +61,11 @@ account closed accounts in team counts
|
|||
IE10 no sound toggle http://en.lichess.org/forum/lichess-feedback/notification-of-game-creation#3
|
||||
filter current games for watching http://en.lichess.org/forum/lichess-feedback/viewing-current-games-suggestion#2
|
||||
declined challenge still appears
|
||||
no time data http://en.lichess.org/x9tls3mh/stats
|
||||
second realtime board on homepage (right)
|
||||
show friend games in homepage board
|
||||
allow to filter anon
|
||||
replace plot with watch plot when game starts
|
||||
real rematch against AI
|
||||
lobby table sort
|
||||
fix elo range
|
||||
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in a new issue