Skip to content

Commit

Permalink
pgn model convenience functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jul 8, 2023
1 parent cea3dcc commit ad39f5d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/format/pgn/tagModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ case class Tags(value: List[Tag]) extends AnyVal:

def sorted =
copy(
value = value.sortBy { tag =>
value = value.sortBy: tag =>
Tags.tagIndex.getOrElse(tag.name, 999)
}
)

def players = ByColor(apply(_.White), apply(_.Black))
def elos = ByColor(apply(_.WhiteElo), apply(_.BlackElo)).map(_.flatMap(_.toIntOption))
def titles = ByColor(apply(_.WhiteTitle), apply(_.BlackTitle))

override def toString = sorted.value mkString "\n"

object Tags:
Expand Down

0 comments on commit ad39f5d

Please sign in to comment.