Coffeehouse Post

Single Post Permalink

View Thread: HumanCompiler.Reproduce();
  • User profile image
    Human​Compiler

    My wife had her first appointment earlier today.  Everything is normal and healthy.  They found the heartbeat immediately, which they said was unusual (in a good way).  This is our first.  Smiley  Just thought I'd have a little fun with our announcement to you all on Channel 9 with a little quick piece of code...

    public class FamilyMember : Baby
    {
    	public FamilyMember()
    	{
    		this.Parents = new Parent() { Parent.Parse("Erik"), Parent.Parse("Stacey") };
    		this.Gender = GenderType.Unknown;
    
    		setupTraits(this.Parents);
    	}
    	
    	private DevelopmentCycle cycle;
    	public DevelopmentCycle Cycle
    	{
    		get
    		{
    			if (cycle == null)
    				cycle = new DevelopmentCycle(this);
    			
    			return cycle;
    		}
    	}
    	
    	private HumanTraits traits;
    	public HumanTraits Traits
    	{
    		get
    		{
    			if (traits == null)
    				traits = new HumanTraits(10);
    			
    			return traits;
    		}
    	}
    	
    	private static void setupTraits(FamilyMember child, Parent[] parents)
    	{
    		for (int i = 0; i < parents[0].Traits.Count; i++)
    			child.Traits.Add(parents[0].Traits[i]);
    
    		for (int i = 0; i < parents[1].Traits.Count; i++)
    			child.Traits.Add(parents[1].Traits[i]);
    
    		child.Traits.MixItUp();
    	}
    }
    
    public static class Startup
    {
    	static void Main()
    	{
    		FamilyMember baby = new FamilyMember();
    
    		baby.FirstName = "TBD";
    		baby.MiddleName = "TBD";
    		baby.LastName = baby.Parents[0].LastName;
    		baby.Cycle.Start(Weeks.Eleven);
    		
    		MessageBox.Show("Baby is due 10/22/2007");
    		
    		Application.Run(baby);
    	}
    }