Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sealed class Health(val infectious: Boolean, val visiblyInfectious: Boolean) {
def evolve(implicit randomGenerator: RandomIntGenerator, config: MySimConfig): Option[HealthChange] =
this match {
case Healthy =>
if (randomGenerator.randomBelow(101) <= config.transmissibilityPct)
Some(new HealthChange(0, Incubatious))
else None
case Incubatious =>
Some(new HealthChange(6, Sick))
case Sick =>
if (randomGenerator.randomBelow(101) <= config.mortalityPct)
Some(new HealthChange(14 - 6, Dead))
else None
case Dead =>
case Immune =>
Some(new HealthChange(18 - 16, Healthy))
case Vaccinated =>
// infected? visibly?
object Healthy extends Health(false, false)
object Incubatious extends Health(true, false)
object Sick extends Health(true, true)
object Dead extends Health(true, true)
object Immune extends Health(true, false)
object Vaccinated extends Health(false, false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment