Monday, July 7, 2014

Parenting.NET

while (child.age < TODDLER) 
{
  if (child.awake)
  {
    if (!this.awake)
    {
      wakeUp(DateTime.Now);
    }
    
    switch (child.state)
    {
      case State.Awake:
        playWithLegos(child);
      
      case State.Tired:
        readBook(child);
      
      case State.Bored:
        if (reallySunnyOutside)
        {
          applySunscreen(child);
        }
        goToPark(child);
      
      case State.Tantrum:
        hideInBedroomWithOtherChild(TANTRUM_DURATION);
      
      case State.Hungry:
        if (checkFridgeIsNotEmpty())
        {
          makeFood(child);
          makeFood(this);
        }
        else
        {
          makeFood(child);
        }
      
      case State.Funny:
        tellJokes(this);
        makeShadowPuppets(this);
        
      case State.ReadyForBed:
        if (child.daysSinceBath >= ACCEPTED_SOCIETAL_BATHING_REGIME)
        {
          giveBath(child);
        }
        goToSleep(child);  // TODO - multi-thread this (can take a long time)
    }
  }
  else
  {
    if (houseIsNotPerfect)    // Possibly refactor this to houseIsAcceptable?
    {
      cleanHouseAndGarden(this);
    }
    else
    {
      sleep(1000);
    }
  }
}

No comments:

Post a Comment