Skip to content

Instantly share code, notes, and snippets.

@jerrinot
Created November 18, 2013 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerrinot/c8d5509235b43a123990 to your computer and use it in GitHub Desktop.
Save jerrinot/c8d5509235b43a123990 to your computer and use it in GitHub Desktop.
HealthState example
public enum Health {
HEALTHY(false, false, false, false),
INCUBATIOUS(true, false, false, false),
SICK(true...),
DEAD(....);
private boolean infected;
private boolean sick;
private boolean immune;
private boolean dead;
private Health(boolean infected, boolean sick, boolean immune, boolean dead) {
this.infected = infected;
this.sick = sick;
this.immune = immune;
this.dead = dead;
}
public boolean isInfected() {
return infected;
}
public boolean isSick() {
return sick;
}
public Health evolve() {
switch (this) {
case HEALTHY:
return computeProbabability..() ? INCUBATIOUS : HEALTHY;
[....]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment