hotfixes
|
@ -28,7 +28,7 @@ sealed trait PieceSetObject {
|
||||||
|
|
||||||
object PieceSet extends PieceSetObject {
|
object PieceSet extends PieceSetObject {
|
||||||
|
|
||||||
val all = NonEmptyList("cburnett", "merida", "pirouetti", "alpha", "spatial", "light") map { name => new PieceSet(name) }
|
val all = NonEmptyList("cburnett", "merida", "pirouetti", "alpha", "spatial", "lightp") map { name => new PieceSet(name) }
|
||||||
}
|
}
|
||||||
|
|
||||||
object PieceSet3d extends PieceSetObject {
|
object PieceSet3d extends PieceSetObject {
|
||||||
|
|
|
@ -18,27 +18,26 @@ private[puzzle] final class Selector(
|
||||||
toleranceMax: Int,
|
toleranceMax: Int,
|
||||||
modulo: Int) {
|
modulo: Int) {
|
||||||
|
|
||||||
private val popularSelector = BSONDocument(
|
private def popularSelector(mate: Boolean) = BSONDocument(
|
||||||
Puzzle.BSONFields.voteSum -> BSONDocument("$gt" -> BSONInteger(anonMinRating)))
|
Puzzle.BSONFields.voteSum -> BSONDocument("$gt" -> BSONInteger(mate.fold(anonMinRating, 0))))
|
||||||
|
|
||||||
private def mateSelector(mate: Boolean) = BSONDocument("mate" -> mate)
|
private def mateSelector(mate: Boolean) = BSONDocument("mate" -> mate)
|
||||||
|
|
||||||
private lazy val popularCount = puzzleColl.db command Count(puzzleColl.name, popularSelector.some)
|
|
||||||
|
|
||||||
private def difficultyDecay(difficulty: Int) = difficulty match {
|
private def difficultyDecay(difficulty: Int) = difficulty match {
|
||||||
case 1 => -200
|
case 1 => -200
|
||||||
case 3 => +200
|
case 3 => +200
|
||||||
case _ => 0
|
case _ => 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val anonSkipMax = 2000
|
||||||
|
|
||||||
def apply(me: Option[User], difficulty: Int): Fu[Puzzle] = {
|
def apply(me: Option[User], difficulty: Int): Fu[Puzzle] = {
|
||||||
val isMate = scala.util.Random.nextBoolean
|
val isMate = scala.util.Random.nextBoolean
|
||||||
me match {
|
me match {
|
||||||
case None => popularCount map (_ - 1) flatMap { skipMax =>
|
case None =>
|
||||||
puzzleColl.find(popularSelector ++ mateSelector(isMate))
|
puzzleColl.find(popularSelector(isMate) ++ mateSelector(isMate))
|
||||||
.options(QueryOpts(skipN = Random nextInt skipMax))
|
.options(QueryOpts(skipN = Random nextInt anonSkipMax))
|
||||||
.one[Puzzle] flatten "Can't find a puzzle for anon player!"
|
.one[Puzzle] flatten "Can't find a puzzle for anon player!"
|
||||||
}
|
|
||||||
case Some(user) => api.attempt.playedIds(user, modulo) flatMap { ids =>
|
case Some(user) => api.attempt.playedIds(user, modulo) flatMap { ids =>
|
||||||
tryRange(user, toleranceStep, difficultyDecay(difficulty), ids, isMate)
|
tryRange(user, toleranceStep, difficultyDecay(difficulty), ids, isMate)
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
@ -384,42 +384,42 @@ body.is2d.spatial .cg-piece.queen.black {
|
||||||
body.is2d.spatial .cg-piece.king.black {
|
body.is2d.spatial .cg-piece.king.black {
|
||||||
background-image: url(../piece/spatial/bK.svg);
|
background-image: url(../piece/spatial/bK.svg);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.pawn.white {
|
body.is2d.lightp .cg-piece.pawn.white {
|
||||||
background-image: url(../piece/light/wP.png);
|
background-image: url(../piece/lightp/wP.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.bishop.white {
|
body.is2d.lightp .cg-piece.bishop.white {
|
||||||
background-image: url(../piece/light/wB.png);
|
background-image: url(../piece/lightp/wB.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.knight.white,
|
body.is2d.lightp .cg-piece.knight.white,
|
||||||
#top .cg-piece.light {
|
#top .cg-piece.lightp {
|
||||||
background-image: url(../piece/light/wN.png);
|
background-image: url(../piece/lightp/wN.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.rook.white {
|
body.is2d.lightp .cg-piece.rook.white {
|
||||||
background-image: url(../piece/light/wR.png);
|
background-image: url(../piece/lightp/wR.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.queen.white {
|
body.is2d.lightp .cg-piece.queen.white {
|
||||||
background-image: url(../piece/light/wQ.png);
|
background-image: url(../piece/lightp/wQ.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.king.white {
|
body.is2d.lightp .cg-piece.king.white {
|
||||||
background-image: url(../piece/light/wK.png);
|
background-image: url(../piece/lightp/wK.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.pawn.black {
|
body.is2d.lightp .cg-piece.pawn.black {
|
||||||
background-image: url(../piece/light/bP.png);
|
background-image: url(../piece/lightp/bP.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.bishop.black {
|
body.is2d.lightp .cg-piece.bishop.black {
|
||||||
background-image: url(../piece/light/bB.png);
|
background-image: url(../piece/lightp/bB.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.knight.black {
|
body.is2d.lightp .cg-piece.knight.black {
|
||||||
background-image: url(../piece/light/bN.png);
|
background-image: url(../piece/lightp/bN.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.rook.black {
|
body.is2d.lightp .cg-piece.rook.black {
|
||||||
background-image: url(../piece/light/bR.png);
|
background-image: url(../piece/lightp/bR.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.queen.black {
|
body.is2d.lightp .cg-piece.queen.black {
|
||||||
background-image: url(../piece/light/bQ.png);
|
background-image: url(../piece/lightp/bQ.png);
|
||||||
}
|
}
|
||||||
body.is2d.light .cg-piece.king.black {
|
body.is2d.lightp .cg-piece.king.black {
|
||||||
background-image: url(../piece/light/bK.png);
|
background-image: url(../piece/lightp/bK.png);
|
||||||
}
|
}
|
||||||
body.is2d.alpha .cg-piece.pawn.white {
|
body.is2d.alpha .cg-piece.pawn.white {
|
||||||
background-image: url(../piece/alpha/wP.svg);
|
background-image: url(../piece/alpha/wP.svg);
|
||||||
|
|
|
@ -499,7 +499,7 @@ div.content_box .loader:after {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.none {
|
.none {
|
||||||
display: none!important;
|
display: none;
|
||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
@ -1008,8 +1008,11 @@ body.offline #nb_connected_players {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 5px 10px 10px 10px;
|
padding: 5px 10px 10px 10px;
|
||||||
}
|
}
|
||||||
#top #message_notifications_tag span:before,
|
#challenge_notifications_tag.none {
|
||||||
#top #challenge_notifications_tag span:before {
|
display: none!important;
|
||||||
|
}
|
||||||
|
#message_notifications_tag span:before,
|
||||||
|
#challenge_notifications_tag span:before {
|
||||||
font-size: 1.45em;
|
font-size: 1.45em;
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
}
|
}
|
||||||
|
|