From 9845bdac4a78576d3f5b3a0c9dd8d74f075e2a38 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Fri, 4 Sep 2015 23:31:10 +0200 Subject: [PATCH] more RacingKings integration --- app/controllers/User.scala | 2 ++ app/templating/GameHelper.scala | 2 ++ app/templating/UserHelper.scala | 5 +++-- app/views/game/variantLink.scala.html | 1 + app/views/user/list.scala.html | 3 ++- app/views/user/show.scala.html | 3 +++ conf/messages | 1 + conf/messages.de | 1 + modules/game/src/main/PgnDump.scala | 2 +- modules/history/src/main/History.scala | 3 +++ modules/history/src/main/RatingChartApi.scala | 2 +- modules/i18n/src/main/I18nKeys.scala | 5 +++-- modules/rating/src/main/PerfType.scala | 14 ++++++++++---- modules/round/src/main/PerfsUpdater.scala | 6 ++++++ modules/simul/src/main/DataForm.scala | 5 +++-- modules/tournament/src/main/DataForm.scala | 5 +++-- modules/tv/src/main/Tv.scala | 6 +++++- modules/user/src/main/Perfs.scala | 9 ++++++++- 18 files changed, 58 insertions(+), 17 deletions(-) diff --git a/app/controllers/User.scala b/app/controllers/User.scala index bde26655c7..86146f6cf4 100644 --- a/app/controllers/User.scala +++ b/app/controllers/User.scala @@ -139,6 +139,7 @@ object User extends LilaController { antichess <- env.cached topPerf PerfType.Antichess.key atomic <- env.cached topPerf PerfType.Atomic.key horde <- env.cached topPerf PerfType.Horde.key + racingKings <- env.cached topPerf PerfType.RacingKings.key nbAllTime ← env.cached topNbGame nb map2 { (user: UserModel) => user -> user.count.game } @@ -160,6 +161,7 @@ object User extends LilaController { antichess = antichess, atomic = atomic, horde = horde, + racingKings = racingKings, nbWeek = nbWeek, nbAllTime = nbAllTime))), api = _ => fuccess { diff --git a/app/templating/GameHelper.scala b/app/templating/GameHelper.scala index 34038b54c0..7ce6ddbae8 100644 --- a/app/templating/GameHelper.scala +++ b/app/templating/GameHelper.scala @@ -51,6 +51,7 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel case chess.variant.Antichess => "Lose all your pieces to win" case chess.variant.Atomic => "Explode or mate your opponent's king to win" case chess.variant.Horde => "Destroy the horde to win" + case chess.variant.RacingKings => "Race to the eighth rank to win" case _ => "Variant ending" } case _ => "Game is still being played" @@ -156,6 +157,7 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel case S.VariantEnd => game.variant match { case chess.variant.KingOfTheHill => trans.kingInTheCenter() case chess.variant.ThreeCheck => trans.threeChecks() + case chess.variant.RacingKings => trans.raceFinished() case _ => trans.variantEnding() } case _ => Html("") diff --git a/app/templating/UserHelper.scala b/app/templating/UserHelper.scala index 289ab6f9da..80e3af27ca 100644 --- a/app/templating/UserHelper.scala +++ b/app/templating/UserHelper.scala @@ -33,14 +33,15 @@ trait UserHelper { self: I18nHelper with StringHelper with NumberHelper => PerfType.Correspondence, PerfType.Antichess, PerfType.Atomic, - PerfType.Horde) + PerfType.Horde, + PerfType.RacingKings) private def best4Of(u: User, perfTypes: List[PerfType]) = perfTypes.sortBy { pt => -u.perfs(pt).nb } take 4 def miniViewSortedPerfTypes(u: User): List[PerfType] = best4Of(u, List(PerfType.Bullet, PerfType.Blitz, PerfType.Classical, PerfType.Correspondence)) ::: - best4Of(u, List(PerfType.Chess960, PerfType.KingOfTheHill, PerfType.ThreeCheck, PerfType.Antichess, PerfType.Atomic, PerfType.Horde)) + best4Of(u, List(PerfType.Chess960, PerfType.KingOfTheHill, PerfType.ThreeCheck, PerfType.Antichess, PerfType.Atomic, PerfType.Horde, PerfType.RacingKings)) def showPerfRating(rating: Int, name: String, nb: Int, provisional: Boolean, icon: Char, klass: String)(implicit ctx: Context) = Html { val title = s"$name rating over ${nb.localize} games" diff --git a/app/views/game/variantLink.scala.html b/app/views/game/variantLink.scala.html index 1adc031e87..709765afae 100644 --- a/app/views/game/variantLink.scala.html +++ b/app/views/game/variantLink.scala.html @@ -9,6 +9,7 @@ case chess.variant.Antichess => {http://en.wikipedia.org/wiki/Losing_chess} case chess.variant.FromPosition => {@routes.Editor.index?fen=@initialFen.map(_.replace(" ", "_"))} case chess.variant.Atomic => {http://www.freechess.org/Help/HelpFiles/atomic.html} case chess.variant.Horde => {http://en.wikipedia.org/wiki/Dunsany%27s_chess} +case chess.variant.RacingKings => {http://www.chessvariants.org/diffobjective.dir/racing.html} case _ => {} } } diff --git a/app/views/user/list.scala.html b/app/views/user/list.scala.html index 7107d6c46d..c328f813ed 100644 --- a/app/views/user/list.scala.html +++ b/app/views/user/list.scala.html @@ -1,4 +1,4 @@ -@(tourneyWinners: List[lila.tournament.Winner], online: List[User], bullet: List[User], blitz: List[User], classical: List[User], chess960: List[User], kingOfTheHill: List[User], threeCheck: List[User], antichess: List[User], atomic: List[User], horde: List[User], nbWeek: List[(User, Int)], nbAllTime: List[(User, Int)])(implicit ctx: Context) +@(tourneyWinners: List[lila.tournament.Winner], online: List[User], bullet: List[User], blitz: List[User], classical: List[User], chess960: List[User], kingOfTheHill: List[User], threeCheck: List[User], antichess: List[User], atomic: List[User], horde: List[User], racingKings: List[User], nbWeek: List[(User, Int)], nbAllTime: List[(User, Int)])(implicit ctx: Context) @import lila.rating.PerfType @@ -97,6 +97,7 @@ description = "Best chess players in bullet, blitz, classical, Chess960 and more @userTopPerf(horde, PerfType.Horde) @userTopPerf(antichess, PerfType.Antichess) @userTopPerf(atomic, PerfType.Atomic) + @userTopPerf(racingKings, PerfType.RacingKings) diff --git a/app/views/user/show.scala.html b/app/views/user/show.scala.html index 32e160eb8f..1458237240 100644 --- a/app/views/user/show.scala.html +++ b/app/views/user/show.scala.html @@ -69,6 +69,9 @@ @if(u.perfs.horde.nonEmpty) { @showPerf(u.perfs.horde, PerfType.Horde) } + @if(u.perfs.racingKings.nonEmpty) { + @showPerf(u.perfs.racingKings, PerfType.RacingKings) + }
} @showPerf(u.perfs.puzzle, PerfType.Puzzle) diff --git a/conf/messages b/conf/messages index 6f7f8591fb..d03090c8fb 100644 --- a/conf/messages +++ b/conf/messages @@ -21,6 +21,7 @@ whiteIsVictorious=White is victorious blackIsVictorious=Black is victorious kingInTheCenter=King in the center threeChecks=Three checks +raceFinished=Race finished variantEnding=Variant ending playWithTheSameOpponentAgain=Play with the same opponent again newOpponent=New opponent diff --git a/conf/messages.de b/conf/messages.de index b4812ac520..059ab008ca 100644 --- a/conf/messages.de +++ b/conf/messages.de @@ -21,6 +21,7 @@ whiteIsVictorious=Weiß hat gewonnen blackIsVictorious=Schwarz hat gewonnen kingInTheCenter=König in der Mitte threeChecks=Dreimaliges Schachgeben +raceFinished=Rennen beendet variantEnding=Ende der Variante playWithTheSameOpponentAgain=Mit dem gleichen Gegner noch einmal spielen newOpponent=Neuer Gegner diff --git a/modules/game/src/main/PgnDump.scala b/modules/game/src/main/PgnDump.scala index 27f2113bea..3b13d354ed 100644 --- a/modules/game/src/main/PgnDump.scala +++ b/modules/game/src/main/PgnDump.scala @@ -45,7 +45,7 @@ final class PgnDump( p.aiLevel.fold(u.fold(p.name | lila.user.User.anonymous)(_.name))("lichess AI level " + _) private val customStartPosition: Set[chess.variant.Variant] = - Set(chess.variant.Chess960, chess.variant.FromPosition, chess.variant.Horde) + Set(chess.variant.Chess960, chess.variant.FromPosition, chess.variant.Horde, chess.variant.RacingKings) private def tags(game: Game, initialFen: Option[String]): List[Tag] = gameLightUsers(game) match { case (wu, bu) => List( diff --git a/modules/history/src/main/History.scala b/modules/history/src/main/History.scala index 6547c4565d..6d0d841066 100644 --- a/modules/history/src/main/History.scala +++ b/modules/history/src/main/History.scala @@ -11,6 +11,7 @@ case class History( threeCheck: RatingsMap, atomic: RatingsMap, horde: RatingsMap, + racingKings: RatingsMap, bullet: RatingsMap, blitz: RatingsMap, classical: RatingsMap, @@ -29,6 +30,7 @@ case class History( case PerfType.ThreeCheck => threeCheck case PerfType.Atomic => atomic case PerfType.Horde => horde + case PerfType.RacingKings => racingKings case PerfType.Puzzle => puzzle case x => sys error s"No history for perf $x" } @@ -59,6 +61,7 @@ object History { antichess = ratingsMap("antichess"), atomic = ratingsMap("atomic"), horde = ratingsMap("horde"), + racingKings = ratingsMap("racingKings"), bullet = ratingsMap("bullet"), blitz = ratingsMap("blitz"), classical = ratingsMap("classical"), diff --git a/modules/history/src/main/RatingChartApi.scala b/modules/history/src/main/RatingChartApi.scala index c272287d4b..688cd09edb 100644 --- a/modules/history/src/main/RatingChartApi.scala +++ b/modules/history/src/main/RatingChartApi.scala @@ -49,7 +49,7 @@ final class RatingChartApi( Json stringify { Json.toJson { import lila.rating.PerfType._ - List(Bullet, Blitz, Classical, Correspondence, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, Puzzle) map { pt => + List(Bullet, Blitz, Classical, Correspondence, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings, Puzzle) map { pt => ratingsMapToJson(pt, history(pt)) } } diff --git a/modules/i18n/src/main/I18nKeys.scala b/modules/i18n/src/main/I18nKeys.scala index 4b9c65cfc9..c8dd2df9ee 100644 --- a/modules/i18n/src/main/I18nKeys.scala +++ b/modules/i18n/src/main/I18nKeys.scala @@ -1,4 +1,4 @@ -// Generated with bin/trans-dump at 2015-09-03 00:34:22 UTC +// Generated with bin/trans-dump at 2015-09-04 21:23:33 UTC package lila.i18n import play.twirl.api.Html @@ -45,6 +45,7 @@ final class I18nKeys(translator: Translator) { val `blackIsVictorious` = new Key("blackIsVictorious") val `kingInTheCenter` = new Key("kingInTheCenter") val `threeChecks` = new Key("threeChecks") + val `raceFinished` = new Key("raceFinished") val `variantEnding` = new Key("variantEnding") val `playWithTheSameOpponentAgain` = new Key("playWithTheSameOpponentAgain") val `newOpponent` = new Key("newOpponent") @@ -532,7 +533,7 @@ final class I18nKeys(translator: Translator) { val `tournamentMayHaveBeenCanceled` = new Key("tournamentMayHaveBeenCanceled") val `returnToTournamentsHomepage` = new Key("returnToTournamentsHomepage") - def keys = List(`playWithAFriend`, `playWithTheMachine`, `toInviteSomeoneToPlayGiveThisUrl`, `gameOver`, `waitingForOpponent`, `waiting`, `yourTurn`, `aiNameLevelAiLevel`, `level`, `toggleTheChat`, `toggleSound`, `chat`, `resign`, `checkmate`, `stalemate`, `white`, `black`, `randomColor`, `createAGame`, `whiteIsVictorious`, `blackIsVictorious`, `kingInTheCenter`, `threeChecks`, `variantEnding`, `playWithTheSameOpponentAgain`, `newOpponent`, `playWithAnotherOpponent`, `yourOpponentWantsToPlayANewGameWithYou`, `joinTheGame`, `whitePlays`, `blackPlays`, `theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim`, `makeYourOpponentResign`, `forceResignation`, `forceDraw`, `talkInChat`, `theFirstPersonToComeOnThisUrlWillPlayWithYou`, `whiteCreatesTheGame`, `blackCreatesTheGame`, `whiteJoinsTheGame`, `blackJoinsTheGame`, `whiteResigned`, `blackResigned`, `whiteLeftTheGame`, `blackLeftTheGame`, `shareThisUrlToLetSpectatorsSeeTheGame`, `replayAndAnalyse`, `computerAnalysisInProgress`, `theComputerAnalysisHasFailed`, `viewTheComputerAnalysis`, `requestAComputerAnalysis`, `computerAnalysis`, `analysis`, `blunders`, `mistakes`, `inaccuracies`, `moveTimes`, `flipBoard`, `threefoldRepetition`, `claimADraw`, `offerDraw`, `draw`, `nbConnectedPlayers`, `gamesBeingPlayedRightNow`, `viewAllNbGames`, `viewNbCheckmates`, `nbBookmarks`, `nbPopularGames`, `nbAnalysedGames`, `bookmarkedByNbPlayers`, `viewInFullSize`, `logOut`, `signIn`, `newToLichess`, `youNeedAnAccountToDoThat`, `signUp`, `computersAreNotAllowedToPlay`, `games`, `forum`, `xPostedInForumY`, `latestForumPosts`, `players`, `minutesPerSide`, `variant`, `variants`, `timeControl`, `realTime`, `correspondence`, `daysPerTurn`, `oneDay`, `nbDays`, `nbHours`, `time`, `rating`, `username`, `password`, `haveAnAccount`, `changePassword`, `changeEmail`, `email`, `emailIsOptional`, `passwordReset`, `forgotPassword`, `learnMoreAboutLichess`, `rank`, `gamesPlayed`, `nbGamesWithYou`, `declineInvitation`, `cancel`, `timeOut`, `drawOfferSent`, `drawOfferDeclined`, `drawOfferAccepted`, `drawOfferCanceled`, `whiteOffersDraw`, `blackOffersDraw`, `whiteDeclinesDraw`, `blackDeclinesDraw`, `yourOpponentOffersADraw`, `accept`, `decline`, `playingRightNow`, `finished`, `abortGame`, `gameAborted`, `standard`, `unlimited`, `mode`, `casual`, `rated`, `thisGameIsRated`, `rematch`, `rematchOfferSent`, `rematchOfferAccepted`, `rematchOfferCanceled`, `rematchOfferDeclined`, `cancelRematchOffer`, `viewRematch`, `play`, `inbox`, `chatRoom`, `spectatorRoom`, `composeMessage`, `noNewMessages`, `subject`, `recipient`, `send`, `incrementInSeconds`, `freeOnlineChess`, `spectators`, `nbWins`, `nbLosses`, `nbDraws`, `exportGames`, `ratingRange`, `giveNbSeconds`, `premoveEnabledClickAnywhereToCancel`, `thisPlayerUsesChessComputerAssistance`, `thisPlayerArtificiallyIncreasesTheirRating`, `opening`, `takeback`, `proposeATakeback`, `takebackPropositionSent`, `takebackPropositionDeclined`, `takebackPropositionAccepted`, `takebackPropositionCanceled`, `yourOpponentProposesATakeback`, `bookmarkThisGame`, `search`, `advancedSearch`, `tournament`, `tournaments`, `tournamentPoints`, `viewTournament`, `backToTournament`, `backToGame`, `freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents`, `teams`, `nbMembers`, `allTeams`, `newTeam`, `myTeams`, `noTeamFound`, `joinTeam`, `quitTeam`, `anyoneCanJoin`, `aConfirmationIsRequiredToJoin`, `joiningPolicy`, `teamLeader`, `teamBestPlayers`, `teamRecentMembers`, `xJoinedTeamY`, `xCreatedTeamY`, `averageElo`, `location`, `settings`, `filterGames`, `reset`, `apply`, `leaderboard`, `pasteTheFenStringHere`, `pasteThePgnStringHere`, `fromPosition`, `continueFromHere`, `importGame`, `nbImportedGames`, `thisIsAChessCaptcha`, `clickOnTheBoardToMakeYourMove`, `notACheckmate`, `colorPlaysCheckmateInOne`, `retry`, `reconnecting`, `onlineFriends`, `noFriendsOnline`, `findFriends`, `favoriteOpponents`, `follow`, `following`, `unfollow`, `block`, `blocked`, `unblock`, `followsYou`, `xStartedFollowingY`, `nbFollowers`, `nbFollowing`, `more`, `memberSince`, `lastLogin`, `challengeToPlay`, `player`, `list`, `graph`, `lessThanNbMinutes`, `xToYMinutes`, `textIsTooShort`, `textIsTooLong`, `required`, `openTournaments`, `duration`, `winner`, `standing`, `createANewTournament`, `join`, `withdraw`, `points`, `wins`, `losses`, `winStreak`, `createdBy`, `tournamentIsStarting`, `membersOnly`, `boardEditor`, `startPosition`, `clearBoard`, `savePosition`, `loadPosition`, `isPrivate`, `reportXToModerators`, `profile`, `editProfile`, `firstName`, `lastName`, `biography`, `country`, `preferences`, `watchLichessTV`, `previouslyOnLichessTV`, `todaysLeaders`, `onlinePlayers`, `progressToday`, `progressThisWeek`, `progressThisMonth`, `leaderboardThisWeek`, `leaderboardThisMonth`, `activeToday`, `activeThisWeek`, `activePlayers`, `bewareTheGameIsRatedButHasNoClock`, `training`, `yourPuzzleRatingX`, `findTheBestMoveForWhite`, `findTheBestMoveForBlack`, `toTrackYourProgress`, `trainingSignupExplanation`, `recentlyPlayedPuzzles`, `puzzleId`, `puzzleOfTheDay`, `clickToSolve`, `goodMove`, `butYouCanDoBetter`, `bestMove`, `keepGoing`, `puzzleFailed`, `butYouCanKeepTrying`, `victory`, `giveUp`, `puzzleSolvedInXSeconds`, `wasThisPuzzleAnyGood`, `pleaseVotePuzzle`, `thankYou`, `ratingX`, `playedXTimes`, `fromGameLink`, `startTraining`, `continueTraining`, `retryThisPuzzle`, `thisPuzzleIsCorrect`, `thisPuzzleIsWrong`, `youHaveNbSecondsToMakeYourFirstMove`, `nbGamesInPlay`, `automaticallyProceedToNextGameAfterMoving`, `autoSwitch`, `openingId`, `yourOpeningRatingX`, `findNbStrongMoves`, `thisMoveGivesYourOpponentTheAdvantage`, `openingFailed`, `openingSolved`, `recentlyPlayedOpenings`, `puzzles`, `coordinates`, `openings`, `latestUpdates`, `tournamentWinners`, `name`, `description`, `no`, `yes`, `help`, `createANewTopic`, `topics`, `posts`, `lastPost`, `views`, `replies`, `replyToThisTopic`, `reply`, `message`, `createTheTopic`, `reportAUser`, `user`, `reason`, `whatIsIheMatter`, `cheat`, `insult`, `troll`, `other`, `reportDescriptionHelp`, `by`, `thisTopicIsNowClosed`, `theming`, `donate`, `blog`, `map`, `realTimeWorldMapOfChessMoves`, `questionsAndAnswers`, `notes`, `typePrivateNotesHere`, `gameDisplay`, `pieceAnimation`, `materialDifference`, `closeAccount`, `closeYourAccount`, `changedMindDoNotCloseAccount`, `closeAccountExplanation`, `thisAccountIsClosed`, `invalidUsernameOrPassword`, `emailMeALink`, `currentPassword`, `newPassword`, `newPasswordAgain`, `boardHighlights`, `pieceDestinations`, `boardCoordinates`, `moveListWhilePlaying`, `chessClock`, `tenthsOfSeconds`, `never`, `whenTimeRemainingLessThanTenSeconds`, `horizontalGreenProgressBars`, `soundWhenTimeGetsCritical`, `gameBehavior`, `premovesPlayingDuringOpponentTurn`, `takebacksWithOpponentApproval`, `promoteToQueenAutomatically`, `claimDrawOnThreefoldRepetitionAutomatically`, `privacy`, `letOtherPlayersFollowYou`, `letOtherPlayersChallengeYou`, `sound`, `soundControlInTheTopBarOfEveryPage`, `yourPreferencesHaveBeenSaved`, `none`, `fast`, `normal`, `slow`, `insideTheBoard`, `outsideTheBoard`, `onSlowGames`, `always`, `inCasualGamesOnly`, `whenPremoving`, `whenTimeRemainingLessThanThirtySeconds`, `difficultyEasy`, `difficultyNormal`, `difficultyHard`, `xLeftANoteOnY`, `xCompetesInY`, `xAskedY`, `xAnsweredY`, `xCommentedY`, `timeline`, `seeAllTournaments`, `starting`, `allInformationIsPublicAndOptional`, `yourCityRegionOrDepartment`, `biographyDescription`, `maximumNbCharacters`, `blocks`, `listBlockedPlayers`, `human`, `computer`, `side`, `clock`, `unauthorizedError`, `noInternetConnection`, `connectedToLichess`, `signedOut`, `loginSuccessful`, `playOnTheBoardOffline`, `playOfflineComputer`, `opponent`, `learn`, `community`, `tools`, `increment`, `board`, `pieces`, `sharePGN`, `playOnline`, `playOffline`, `allowAnalytics`, `shareGameURL`, `error.required`, `error.email`, `error.email_acceptable`, `error.email_unique`, `blindfoldChess`, `moveConfirmation`, `inCorrespondenceGames`, `ifRatingIsPlusMinusX`, `onlyFriends`, `menu`, `castling`, `whiteCastlingKingside`, `whiteCastlingQueenside`, `blackCastlingKingside`, `blackCastlingQueenside`, `nbForumPosts`, `tpTimeSpentPlaying`, `watchGames`, `tpTimeSpentOnTV`, `watch`, `internationalEvents`, `videoLibrary`, `mobileApp`, `webmasters`, `contribute`, `contact`, `termsOfService`, `sourceCode`, `simultaneousExhibitions`, `host`, `createdSimuls`, `hostANewSimul`, `noSimulFound`, `noSimulExplanation`, `returnToSimulHomepage`, `aboutSimul`, `aboutSimulImage`, `aboutSimulRealLife`, `aboutSimulRules`, `aboutSimulSettings`, `create`, `whenCreateSimul`, `joinExistingSimul`, `simulVariantsHint`, `simulClockHint`, `simulAddExtraTime`, `simulHostExtraTime`, `lichessTournaments`, `tournamentFAQ`, `tournamentOfficial`, `timeBeforeTournamentStarts`, `averageCentipawnLoss`, `keyboardShortcuts`, `keyMoveBackwardOrForward`, `keyGoToStartOrEnd`, `keyShowOrHideComments`, `keyEnterOrExitVariation`, `keyYouCanDrawArrowsCirclesAndScrollToMove`, `newTournament`, `tournamentHomeTitle`, `tournamentHomeDescription`, `tournamentNotFound`, `tournamentDoesNotExist`, `tournamentMayHaveBeenCanceled`, `returnToTournamentsHomepage`) + def keys = List(`playWithAFriend`, `playWithTheMachine`, `toInviteSomeoneToPlayGiveThisUrl`, `gameOver`, `waitingForOpponent`, `waiting`, `yourTurn`, `aiNameLevelAiLevel`, `level`, `toggleTheChat`, `toggleSound`, `chat`, `resign`, `checkmate`, `stalemate`, `white`, `black`, `randomColor`, `createAGame`, `whiteIsVictorious`, `blackIsVictorious`, `kingInTheCenter`, `threeChecks`, `raceFinished`, `variantEnding`, `playWithTheSameOpponentAgain`, `newOpponent`, `playWithAnotherOpponent`, `yourOpponentWantsToPlayANewGameWithYou`, `joinTheGame`, `whitePlays`, `blackPlays`, `theOtherPlayerHasLeftTheGameYouCanForceResignationOrWaitForHim`, `makeYourOpponentResign`, `forceResignation`, `forceDraw`, `talkInChat`, `theFirstPersonToComeOnThisUrlWillPlayWithYou`, `whiteCreatesTheGame`, `blackCreatesTheGame`, `whiteJoinsTheGame`, `blackJoinsTheGame`, `whiteResigned`, `blackResigned`, `whiteLeftTheGame`, `blackLeftTheGame`, `shareThisUrlToLetSpectatorsSeeTheGame`, `replayAndAnalyse`, `computerAnalysisInProgress`, `theComputerAnalysisHasFailed`, `viewTheComputerAnalysis`, `requestAComputerAnalysis`, `computerAnalysis`, `analysis`, `blunders`, `mistakes`, `inaccuracies`, `moveTimes`, `flipBoard`, `threefoldRepetition`, `claimADraw`, `offerDraw`, `draw`, `nbConnectedPlayers`, `gamesBeingPlayedRightNow`, `viewAllNbGames`, `viewNbCheckmates`, `nbBookmarks`, `nbPopularGames`, `nbAnalysedGames`, `bookmarkedByNbPlayers`, `viewInFullSize`, `logOut`, `signIn`, `newToLichess`, `youNeedAnAccountToDoThat`, `signUp`, `computersAreNotAllowedToPlay`, `games`, `forum`, `xPostedInForumY`, `latestForumPosts`, `players`, `minutesPerSide`, `variant`, `variants`, `timeControl`, `realTime`, `correspondence`, `daysPerTurn`, `oneDay`, `nbDays`, `nbHours`, `time`, `rating`, `username`, `password`, `haveAnAccount`, `changePassword`, `changeEmail`, `email`, `emailIsOptional`, `passwordReset`, `forgotPassword`, `learnMoreAboutLichess`, `rank`, `gamesPlayed`, `nbGamesWithYou`, `declineInvitation`, `cancel`, `timeOut`, `drawOfferSent`, `drawOfferDeclined`, `drawOfferAccepted`, `drawOfferCanceled`, `whiteOffersDraw`, `blackOffersDraw`, `whiteDeclinesDraw`, `blackDeclinesDraw`, `yourOpponentOffersADraw`, `accept`, `decline`, `playingRightNow`, `finished`, `abortGame`, `gameAborted`, `standard`, `unlimited`, `mode`, `casual`, `rated`, `thisGameIsRated`, `rematch`, `rematchOfferSent`, `rematchOfferAccepted`, `rematchOfferCanceled`, `rematchOfferDeclined`, `cancelRematchOffer`, `viewRematch`, `play`, `inbox`, `chatRoom`, `spectatorRoom`, `composeMessage`, `noNewMessages`, `subject`, `recipient`, `send`, `incrementInSeconds`, `freeOnlineChess`, `spectators`, `nbWins`, `nbLosses`, `nbDraws`, `exportGames`, `ratingRange`, `giveNbSeconds`, `premoveEnabledClickAnywhereToCancel`, `thisPlayerUsesChessComputerAssistance`, `thisPlayerArtificiallyIncreasesTheirRating`, `opening`, `takeback`, `proposeATakeback`, `takebackPropositionSent`, `takebackPropositionDeclined`, `takebackPropositionAccepted`, `takebackPropositionCanceled`, `yourOpponentProposesATakeback`, `bookmarkThisGame`, `search`, `advancedSearch`, `tournament`, `tournaments`, `tournamentPoints`, `viewTournament`, `backToTournament`, `backToGame`, `freeOnlineChessGamePlayChessNowInACleanInterfaceNoRegistrationNoAdsNoPluginRequiredPlayChessWithComputerFriendsOrRandomOpponents`, `teams`, `nbMembers`, `allTeams`, `newTeam`, `myTeams`, `noTeamFound`, `joinTeam`, `quitTeam`, `anyoneCanJoin`, `aConfirmationIsRequiredToJoin`, `joiningPolicy`, `teamLeader`, `teamBestPlayers`, `teamRecentMembers`, `xJoinedTeamY`, `xCreatedTeamY`, `averageElo`, `location`, `settings`, `filterGames`, `reset`, `apply`, `leaderboard`, `pasteTheFenStringHere`, `pasteThePgnStringHere`, `fromPosition`, `continueFromHere`, `importGame`, `nbImportedGames`, `thisIsAChessCaptcha`, `clickOnTheBoardToMakeYourMove`, `notACheckmate`, `colorPlaysCheckmateInOne`, `retry`, `reconnecting`, `onlineFriends`, `noFriendsOnline`, `findFriends`, `favoriteOpponents`, `follow`, `following`, `unfollow`, `block`, `blocked`, `unblock`, `followsYou`, `xStartedFollowingY`, `nbFollowers`, `nbFollowing`, `more`, `memberSince`, `lastLogin`, `challengeToPlay`, `player`, `list`, `graph`, `lessThanNbMinutes`, `xToYMinutes`, `textIsTooShort`, `textIsTooLong`, `required`, `openTournaments`, `duration`, `winner`, `standing`, `createANewTournament`, `join`, `withdraw`, `points`, `wins`, `losses`, `winStreak`, `createdBy`, `tournamentIsStarting`, `membersOnly`, `boardEditor`, `startPosition`, `clearBoard`, `savePosition`, `loadPosition`, `isPrivate`, `reportXToModerators`, `profile`, `editProfile`, `firstName`, `lastName`, `biography`, `country`, `preferences`, `watchLichessTV`, `previouslyOnLichessTV`, `todaysLeaders`, `onlinePlayers`, `progressToday`, `progressThisWeek`, `progressThisMonth`, `leaderboardThisWeek`, `leaderboardThisMonth`, `activeToday`, `activeThisWeek`, `activePlayers`, `bewareTheGameIsRatedButHasNoClock`, `training`, `yourPuzzleRatingX`, `findTheBestMoveForWhite`, `findTheBestMoveForBlack`, `toTrackYourProgress`, `trainingSignupExplanation`, `recentlyPlayedPuzzles`, `puzzleId`, `puzzleOfTheDay`, `clickToSolve`, `goodMove`, `butYouCanDoBetter`, `bestMove`, `keepGoing`, `puzzleFailed`, `butYouCanKeepTrying`, `victory`, `giveUp`, `puzzleSolvedInXSeconds`, `wasThisPuzzleAnyGood`, `pleaseVotePuzzle`, `thankYou`, `ratingX`, `playedXTimes`, `fromGameLink`, `startTraining`, `continueTraining`, `retryThisPuzzle`, `thisPuzzleIsCorrect`, `thisPuzzleIsWrong`, `youHaveNbSecondsToMakeYourFirstMove`, `nbGamesInPlay`, `automaticallyProceedToNextGameAfterMoving`, `autoSwitch`, `openingId`, `yourOpeningRatingX`, `findNbStrongMoves`, `thisMoveGivesYourOpponentTheAdvantage`, `openingFailed`, `openingSolved`, `recentlyPlayedOpenings`, `puzzles`, `coordinates`, `openings`, `latestUpdates`, `tournamentWinners`, `name`, `description`, `no`, `yes`, `help`, `createANewTopic`, `topics`, `posts`, `lastPost`, `views`, `replies`, `replyToThisTopic`, `reply`, `message`, `createTheTopic`, `reportAUser`, `user`, `reason`, `whatIsIheMatter`, `cheat`, `insult`, `troll`, `other`, `reportDescriptionHelp`, `by`, `thisTopicIsNowClosed`, `theming`, `donate`, `blog`, `map`, `realTimeWorldMapOfChessMoves`, `questionsAndAnswers`, `notes`, `typePrivateNotesHere`, `gameDisplay`, `pieceAnimation`, `materialDifference`, `closeAccount`, `closeYourAccount`, `changedMindDoNotCloseAccount`, `closeAccountExplanation`, `thisAccountIsClosed`, `invalidUsernameOrPassword`, `emailMeALink`, `currentPassword`, `newPassword`, `newPasswordAgain`, `boardHighlights`, `pieceDestinations`, `boardCoordinates`, `moveListWhilePlaying`, `chessClock`, `tenthsOfSeconds`, `never`, `whenTimeRemainingLessThanTenSeconds`, `horizontalGreenProgressBars`, `soundWhenTimeGetsCritical`, `gameBehavior`, `premovesPlayingDuringOpponentTurn`, `takebacksWithOpponentApproval`, `promoteToQueenAutomatically`, `claimDrawOnThreefoldRepetitionAutomatically`, `privacy`, `letOtherPlayersFollowYou`, `letOtherPlayersChallengeYou`, `sound`, `soundControlInTheTopBarOfEveryPage`, `yourPreferencesHaveBeenSaved`, `none`, `fast`, `normal`, `slow`, `insideTheBoard`, `outsideTheBoard`, `onSlowGames`, `always`, `inCasualGamesOnly`, `whenPremoving`, `whenTimeRemainingLessThanThirtySeconds`, `difficultyEasy`, `difficultyNormal`, `difficultyHard`, `xLeftANoteOnY`, `xCompetesInY`, `xAskedY`, `xAnsweredY`, `xCommentedY`, `timeline`, `seeAllTournaments`, `starting`, `allInformationIsPublicAndOptional`, `yourCityRegionOrDepartment`, `biographyDescription`, `maximumNbCharacters`, `blocks`, `listBlockedPlayers`, `human`, `computer`, `side`, `clock`, `unauthorizedError`, `noInternetConnection`, `connectedToLichess`, `signedOut`, `loginSuccessful`, `playOnTheBoardOffline`, `playOfflineComputer`, `opponent`, `learn`, `community`, `tools`, `increment`, `board`, `pieces`, `sharePGN`, `playOnline`, `playOffline`, `allowAnalytics`, `shareGameURL`, `error.required`, `error.email`, `error.email_acceptable`, `error.email_unique`, `blindfoldChess`, `moveConfirmation`, `inCorrespondenceGames`, `ifRatingIsPlusMinusX`, `onlyFriends`, `menu`, `castling`, `whiteCastlingKingside`, `whiteCastlingQueenside`, `blackCastlingKingside`, `blackCastlingQueenside`, `nbForumPosts`, `tpTimeSpentPlaying`, `watchGames`, `tpTimeSpentOnTV`, `watch`, `internationalEvents`, `videoLibrary`, `mobileApp`, `webmasters`, `contribute`, `contact`, `termsOfService`, `sourceCode`, `simultaneousExhibitions`, `host`, `createdSimuls`, `hostANewSimul`, `noSimulFound`, `noSimulExplanation`, `returnToSimulHomepage`, `aboutSimul`, `aboutSimulImage`, `aboutSimulRealLife`, `aboutSimulRules`, `aboutSimulSettings`, `create`, `whenCreateSimul`, `joinExistingSimul`, `simulVariantsHint`, `simulClockHint`, `simulAddExtraTime`, `simulHostExtraTime`, `lichessTournaments`, `tournamentFAQ`, `tournamentOfficial`, `timeBeforeTournamentStarts`, `averageCentipawnLoss`, `keyboardShortcuts`, `keyMoveBackwardOrForward`, `keyGoToStartOrEnd`, `keyShowOrHideComments`, `keyEnterOrExitVariation`, `keyYouCanDrawArrowsCirclesAndScrollToMove`, `newTournament`, `tournamentHomeTitle`, `tournamentHomeDescription`, `tournamentNotFound`, `tournamentDoesNotExist`, `tournamentMayHaveBeenCanceled`, `returnToTournamentsHomepage`) lazy val count = keys.size } diff --git a/modules/rating/src/main/PerfType.scala b/modules/rating/src/main/PerfType.scala index 20dcef9162..85899f3b73 100644 --- a/modules/rating/src/main/PerfType.scala +++ b/modules/rating/src/main/PerfType.scala @@ -79,6 +79,12 @@ object PerfType { title = "Horde variant", iconChar = '_') + case object RacingKings extends PerfType(17, + key = "racingKings", + name = chess.variant.RacingKings.name, + title = "Racing kings variant", + iconChar = '^') + case object Puzzle extends PerfType(20, key = "puzzle", name = "Training", @@ -91,7 +97,7 @@ object PerfType { title = "Opening trainer", iconChar = ']') - val all: List[PerfType] = List(Bullet, Blitz, Classical, Correspondence, Standard, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, Puzzle, Opening) + val all: List[PerfType] = List(Bullet, Blitz, Classical, Correspondence, Standard, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings, Puzzle, Opening) val byKey = all map { p => (p.key, p) } toMap val default = Standard @@ -101,8 +107,8 @@ object PerfType { def name(key: Perf.Key): Option[String] = apply(key) map (_.name) - val nonPuzzle: List[PerfType] = List(Bullet, Blitz, Classical, Correspondence, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde) + val nonPuzzle: List[PerfType] = List(Bullet, Blitz, Classical, Correspondence, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings) val nonGame: List[PerfType] = List(Puzzle, Opening) - val leaderboardable: List[PerfType] = List(Bullet, Blitz, Classical, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde) - val variants: List[PerfType] = List(Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde) + val leaderboardable: List[PerfType] = List(Bullet, Blitz, Classical, Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings) + val variants: List[PerfType] = List(Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings) } diff --git a/modules/round/src/main/PerfsUpdater.scala b/modules/round/src/main/PerfsUpdater.scala index b4e75a1518..d2337631ac 100644 --- a/modules/round/src/main/PerfsUpdater.scala +++ b/modules/round/src/main/PerfsUpdater.scala @@ -35,6 +35,8 @@ final class PerfsUpdater(historyApi: HistoryApi) { updateRatings(ratingsW.atomic, ratingsB.atomic, result, system) case chess.variant.Horde => updateRatings(ratingsW.horde, ratingsB.horde, result, system) + case chess.variant.RacingKings => + updateRatings(ratingsW.racingKings, ratingsB.racingKings, result, system) case chess.variant.Standard => game.speed match { case Speed.Bullet => updateRatings(ratingsW.bullet, ratingsB.bullet, result, system) @@ -72,6 +74,7 @@ final class PerfsUpdater(historyApi: HistoryApi) { antichess: Rating, atomic: Rating, horde: Rating, + racingKings: Rating, bullet: Rating, blitz: Rating, classical: Rating, @@ -84,6 +87,7 @@ final class PerfsUpdater(historyApi: HistoryApi) { antichess = perfs.antichess.toRating, atomic = perfs.atomic.toRating, horde = perfs.horde.toRating, + racingKings = perfs.racingKings.toRating, bullet = perfs.bullet.toRating, blitz = perfs.blitz.toRating, classical = perfs.classical.toRating, @@ -122,6 +126,7 @@ final class PerfsUpdater(historyApi: HistoryApi) { antichess = game.ratingVariant.antichess.fold(perfs.antichess.add(ratings.antichess, date), perfs.antichess), atomic = game.ratingVariant.atomic.fold(perfs.atomic.add(ratings.atomic, date), perfs.atomic), horde = game.ratingVariant.horde.fold(perfs.horde.add(ratings.horde, date), perfs.horde), + racingKings = game.ratingVariant.racingKings.fold(perfs.racingKings.add(ratings.racingKings, date), perfs.racingKings), bullet = (isStd && speed == Speed.Bullet).fold(perfs.bullet.add(ratings.bullet, date), perfs.bullet), blitz = (isStd && speed == Speed.Blitz).fold(perfs.blitz.add(ratings.blitz, date), perfs.blitz), classical = (isStd && speed == Speed.Classical).fold(perfs.classical.add(ratings.classical, date), perfs.classical), @@ -134,6 +139,7 @@ final class PerfsUpdater(historyApi: HistoryApi) { antichess = r(perfs.antichess, perfs1.antichess), atomic = r(perfs.atomic, perfs1.atomic), horde = r(perfs.horde, perfs1.horde), + racingKings = r(perfs.racingKings, perfs1.racingKings), bullet = r(perfs.bullet, perfs1.bullet), blitz = r(perfs.blitz, perfs1.blitz), classical = r(perfs.classical, perfs1.classical), diff --git a/modules/simul/src/main/DataForm.scala b/modules/simul/src/main/DataForm.scala index a4b3c868ec..1e607885fc 100644 --- a/modules/simul/src/main/DataForm.scala +++ b/modules/simul/src/main/DataForm.scala @@ -33,8 +33,9 @@ final class DataForm { "clockIncrement" -> numberIn(clockIncrementChoices), "clockExtra" -> numberIn(clockExtraChoices), "variants" -> list { - number.verifying(Set(chess.variant.Standard.id, chess.variant.Chess960.id, chess.variant.KingOfTheHill.id, - chess.variant.ThreeCheck.id, chess.variant.Antichess.id, chess.variant.Atomic.id, chess.variant.Horde.id) contains _) + number.verifying(Set(chess.variant.Standard.id, chess.variant.Chess960.id, + chess.variant.KingOfTheHill.id, chess.variant.ThreeCheck.id, + chess.variant.Antichess.id, chess.variant.Atomic.id, chess.variant.Horde.id, chess.variant.RacingKings.id) contains _) }.verifying("At least one variant", _.nonEmpty), "color" -> stringIn(colorChoices) )(SimulSetup.apply)(SimulSetup.unapply) diff --git a/modules/tournament/src/main/DataForm.scala b/modules/tournament/src/main/DataForm.scala index fca9db4484..f8216865c2 100644 --- a/modules/tournament/src/main/DataForm.scala +++ b/modules/tournament/src/main/DataForm.scala @@ -43,8 +43,9 @@ final class DataForm { "clockIncrement" -> numberIn(clockIncrementPrivateChoices), "minutes" -> numberIn(minutePrivateChoices), "waitMinutes" -> numberIn(waitMinuteChoices), - "variant" -> number.verifying(Set(chess.variant.Standard.id, chess.variant.Chess960.id, chess.variant.KingOfTheHill.id, - chess.variant.ThreeCheck.id, chess.variant.Antichess.id, chess.variant.Atomic.id, chess.variant.Horde.id) contains _), + "variant" -> number.verifying(Set(chess.variant.Standard.id, chess.variant.Chess960.id, + chess.variant.KingOfTheHill.id, chess.variant.ThreeCheck.id, chess.variant.Antichess.id, + chess.variant.Atomic.id, chess.variant.Horde.id, chess.variant.RacingKings.id) contains _), "position" -> nonEmptyText.verifying(positions contains _), "mode" -> optional(number.verifying(Mode.all map (_.id) contains _)), "private" -> optional(text.verifying("on" == _)) diff --git a/modules/tv/src/main/Tv.scala b/modules/tv/src/main/Tv.scala index 9d4b9edd5f..87f6689bc2 100644 --- a/modules/tv/src/main/Tv.scala +++ b/modules/tv/src/main/Tv.scala @@ -89,6 +89,10 @@ object Tv { name = V.Horde.name, icon = P.Horde.iconChar.toString, filters = Seq(variant(V.Horde), freshBlitz)) + case object RacingKings extends Channel( + name = V.RacingKings.name, + icon = P.RacingKings.iconChar.toString, + filters = Seq(variant(V.RacingKings), freshBlitz)) case object Computer extends Channel( name = "Computer", icon = ":", @@ -96,7 +100,7 @@ object Tv { val all = List( Best, Bullet, Blitz, Classical, - Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, + Chess960, KingOfTheHill, ThreeCheck, Antichess, Atomic, Horde, RacingKings, Computer) val byKey = all.map { c => c.key -> c }.toMap } diff --git a/modules/user/src/main/Perfs.scala b/modules/user/src/main/Perfs.scala index 602656a5fd..ba63ccd822 100644 --- a/modules/user/src/main/Perfs.scala +++ b/modules/user/src/main/Perfs.scala @@ -14,6 +14,7 @@ case class Perfs( antichess: Perf, atomic: Perf, horde: Perf, + racingKings: Perf, bullet: Perf, blitz: Perf, classical: Perf, @@ -29,6 +30,7 @@ case class Perfs( "antichess" -> antichess, "atomic" -> atomic, "horde" -> horde, + "racingKings" -> racingKings, "bullet" -> bullet, "blitz" -> blitz, "classical" -> classical, @@ -77,6 +79,7 @@ case class Perfs( "antichess" -> antichess, "atomic" -> atomic, "horde" -> horde, + "racingKings" -> racingKings, "bullet" -> bullet, "blitz" -> blitz, "classical" -> classical, @@ -102,6 +105,7 @@ case class Perfs( case PerfType.Antichess => antichess case PerfType.Atomic => atomic case PerfType.Horde => horde + case PerfType.RacingKings => racingKings case PerfType.Puzzle => puzzle case PerfType.Opening => opening } @@ -133,7 +137,7 @@ case object Perfs { val default = { val p = Perf.default - Perfs(p, p, p, p, p, p, p, p, p, p, p, p, p) + Perfs(p, p, p, p, p, p, p, p, p, p, p, p, p, p) } def variantLens(variant: chess.variant.Variant): Option[Perfs => Perf] = variant match { @@ -144,6 +148,7 @@ case object Perfs { case chess.variant.Antichess => Some(_.antichess) case chess.variant.Atomic => Some(_.atomic) case chess.variant.Horde => Some(_.horde) + case chess.variant.RacingKings => Some(_.racingKings) case _ => none } @@ -169,6 +174,7 @@ case object Perfs { antichess = perf("antichess"), atomic = perf("atomic"), horde = perf("horde"), + racingKings = perf("racingKings"), bullet = perf("bullet"), blitz = perf("blitz"), classical = perf("classical"), @@ -187,6 +193,7 @@ case object Perfs { "antichess" -> notNew(o.antichess), "atomic" -> notNew(o.atomic), "horde" -> notNew(o.horde), + "racingKings" -> notNew(o.racingKings), "bullet" -> notNew(o.bullet), "blitz" -> notNew(o.blitz), "classical" -> notNew(o.classical),