infer that game is from position if a FEN is given in the import

pull/83/head
Thibault Duplessis 2013-09-14 17:55:17 +02:00
parent 122845ec61
commit 5f3ef2f704
2 changed files with 3 additions and 2 deletions

View File

@ -31,8 +31,10 @@ private[importer] case class ImportData(pgn: String) {
def tag(which: Tag.type TagType): Option[String] =
tags find (_.name == which(Tag)) map (_.value)
val variant = tag(_.Variant).flatMap(v Variant(v.value)) | Variant.Standard
val initBoard = tag(_.FEN) flatMap Forsyth.<< map (_.board)
val variant = tag(_.Variant).flatMap(v Variant(v.value)) | {
initBoard.nonEmpty.fold(Variant.FromPosition, Variant.Standard)
}
val result = tag(_.Result) filterNot (_ game.situation.end) collect {
case "1-0" Result(Status.Resign, Color.White.some)

1
todo
View File

@ -64,4 +64,3 @@ edit board from play fen
clickable mistakes list in analysis
FEN/editor castle/enpassant https://github.com/ornicar/lila/issues/42
stupid team forum slug http://ru.lichess.org/forum/team-4epa250h
import PGN with FEN position without chess960 (handicap) (claymore on #chess)