private void MoveBodyAlongOverHead() { if (this.Butt != null) { BunnyBody current = this.Butt; var tempLocation = current.Location; current.Location = this.Location; } }
public override List <Point> GetAllLocations() { var result = new List <Point>(); if (this != null) { result.Add(this.Location); BunnyBody current = this.Butt; result.Add(current.Location); } return(result); }
public Bunny(uint senses, uint stamina, uint boldness, Grid currentGrid) { this.Vision = senses; this.Hearing = senses; this.Smell = senses; this.Stamina = stamina; this.Boldness = boldness; ExtensionGenes = new Random(currentGrid.GridSeed.Next(1000000)); InitializeAnimal( this.Stamina, ExtensionGenes.Next(4).ToDirection(), GetFullHealth(this.Stamina)); Location = GetEggSpot(currentGrid); this.Butt = new BunnyBody(this, this.Location); }
public BunnyBody(Bunny hd, Point loc) { Location = loc; Head = hd; Butt = null; }
public Bunny(Bunny firstParent, Bunny secondParent, Grid currentGrid) { ExtensionGenes = firstParent.ExtensionGenes; decimal firstParentRatio = (decimal)currentGrid.GridSeed.Next(101) / (decimal)100; decimal secondParentRatio = 1 - firstParentRatio; var vis = ((firstParent.Vision * firstParentRatio) + (secondParent.Vision * secondParentRatio) + this.RandomMutation()); if (vis < 0) { this.Vision = 0; } else { this.Vision = (uint)vis; } var sta = (firstParent.Stamina * firstParentRatio) + (secondParent.Stamina * secondParentRatio) + this.RandomMutation(); if (sta < 0) { this.Stamina = 0; } else { this.Stamina = (uint)sta; } var hear = ((firstParent.Hearing * firstParentRatio) + (secondParent.Hearing * secondParentRatio) + this.RandomMutation()); if (hear < 0) { this.Hearing = 0; } else { this.Hearing = (uint)hear; } var smel = ((firstParent.Smell * firstParentRatio) + (secondParent.Smell * secondParentRatio) + this.RandomMutation()); if (smel < 0) { this.Smell = 0; } else { this.Smell = (uint)smel; } var bol = ((firstParent.Boldness * firstParentRatio) + (secondParent.Boldness * secondParentRatio) + this.RandomMutation()); if (bol < 0) { this.Boldness = 0; } else { this.Boldness = (uint)bol; } InitializeAnimal( this.Stamina, ExtensionGenes.Next(4).ToDirection(), GetFullHealth(this.Stamina)); Location = GetEggSpot(currentGrid, firstParent.Location); this.Butt = new BunnyBody(this, this.Location); }