Skip to content

Commit

Permalink
Add helper for ClockPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacl committed Aug 21, 2017
1 parent a87f76a commit f759eb7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/scala/Clock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ case class ClockPlayer(
def increment = if (berserk) Centis(0) else config.increment
}

object ClockPlayer {
def withConfig(config: Clock.Config) = ClockPlayer(
config,
LagTracker.forClock(config)
)
}

object Clock {
private val limitFormatter = new DecimalFormat("#.##")

Expand Down Expand Up @@ -190,10 +197,7 @@ object Clock {
def apply(limit: Int, increment: Int): Clock = apply(Config(limit, increment))

def apply(config: Config): Clock = {
val player = ClockPlayer(
config = config,
lag = LagTracker.forClock(config)
)
val player = ClockPlayer.withConfig(config)
Clock(
config = config,
color = White,
Expand Down

0 comments on commit f759eb7

Please sign in to comment.