dererXII.scalashogi_2.13.5.0.2.source-code.MoveMetrics.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalashogi_2.13 Show documentation
Show all versions of scalashogi_2.13 Show documentation
Shogi API written in scala. Immutable and free of side effects.
package shogi
final case class MoveMetrics(
clientLag: Option[Centis] = None,
clientMoveTime: Option[Centis] = None
) {
// Calculate client reported lag given the server's duration for the move.
def reportedLag(elapsed: Centis) =
clientMoveTime.fold(clientLag)(mt => Some(elapsed - mt))
}
object MoveMetrics {
def empty = MoveMetrics(None, None)
}