tweak featured game elo heuristic

This commit is contained in:
Thibault Duplessis 2012-06-24 19:53:08 +02:00
parent 3dfd7bceda
commit f1c7eec1f4
3 changed files with 6 additions and 8 deletions

View file

@ -48,8 +48,6 @@ case class DbPlayer(
def hasMoveTimes = moveTimes.size > 8 def hasMoveTimes = moveTimes.size > 8
def eloEstimation = elo | 1200
def moveTimeList: List[Int] = def moveTimeList: List[Int] =
moveTimes.split(" ").toList map parseIntOption flatten moveTimes.split(" ").toList map parseIntOption flatten

View file

@ -70,7 +70,7 @@ object Featured {
private type Heuristic = DbGame Float private type Heuristic = DbGame Float
private val heuristicBox = box(0 to 1) _ private val heuristicBox = box(0 to 1) _
private val eloBox = box(1200 to 2000) _ private val eloBox = box(1000 to 2000) _
private val timeBox = box(60 to 300) _ private val timeBox = box(60 to 300) _
private val turnBox = box(1 to 21) _ private val turnBox = box(1 to 21) _
@ -81,7 +81,7 @@ object Featured {
progressHeuristic -> 0.5f) progressHeuristic -> 0.5f)
def eloHeuristic(color: Color): Heuristic = game def eloHeuristic(color: Color): Heuristic = game
eloBox(game.player(color).eloEstimation) eloBox(game.player(color).elo | 1000)
def speedHeuristic: Heuristic = game def speedHeuristic: Heuristic = game
1 - timeBox(game.estimateTotalTime) 1 - timeBox(game.estimateTotalTime)

View file

@ -55,7 +55,7 @@ class FeaturedTest extends LilaSpec {
"elo" in { "elo" in {
"game1 white" in { "game1 white" in {
eloHeuristic(chess.Color.White)(game1) must_== 0.5f eloHeuristic(chess.Color.White)(game1) must_== 0.6f
} }
"game1 black" in { "game1 black" in {
eloHeuristic(chess.Color.Black)(game1) must_== 0f eloHeuristic(chess.Color.Black)(game1) must_== 0f
@ -85,13 +85,13 @@ class FeaturedTest extends LilaSpec {
} }
"score" in { "score" in {
"game1" in { "game1" in {
score(game1) must_== 0.5f + 0f + 1f * 0.5f score(game1) must_== 0.6f + 0f + 1f * 0.5f
} }
"game2" in { "game2" in {
score(game2) must_== 0.5f + 0.5f + 0.5f * 0.5f score(game2) must_== 0.6f + 0.5f + 0.5f * 0.5f
} }
"game3" in { "game3" in {
score(game3) must_== 0.5f + 1f + 0f * 0.5f score(game3) must_== 0.6f + 1f + 0f * 0.5f
} }
} }
"best" in { "best" in {