forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buggy implementation of study explorer game insertion
- Loading branch information
Showing
9 changed files
with
93 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
package lila | ||
|
||
package object explorer extends PackageObject with WithPlay | ||
package object explorer extends PackageObject with WithPlay { | ||
|
||
val maxPlies = 50 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package lila.study | ||
|
||
import chess.format.FEN | ||
import lila.game.Game | ||
import lila.round.JsonView.WithFlags | ||
|
||
private object GameToRoot { | ||
|
||
def apply(game: Game, initialFen: Option[FEN], withClocks: Boolean): Node.Root = { | ||
val root = Node.Root.fromRoot { | ||
lila.round.TreeBuilder( | ||
game = game, | ||
analysis = none, | ||
initialFen = initialFen.fold(game.variant.initialFen)(_.value), | ||
withFlags = WithFlags(clocks = withClocks) | ||
) | ||
} | ||
endComment(game).fold(root) { comment => | ||
root updateMainlineLast { _.setComment(comment) } | ||
} | ||
} | ||
|
||
private def endComment(game: Game) = game.finished option { | ||
import lila.tree.Node.Comment | ||
val result = chess.Color.showResult(game.winnerColor) | ||
val status = lila.game.StatusText(game) | ||
val text = s"$result $status" | ||
Comment(Comment.Id.make, Comment.Text(text), Comment.Author.Lichess) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters