コード例 #1
0
 // ctor: create a new animal on the specified position of the given world
 public Animal(OptimizedWatorWorld world, Point position)
 {
     World    = world;
     Position = position;
     Age      = 0;
     Moved    = true;
     Energy   = 0;
     // place the new animal in the world
     World.Grid[position.X, position.Y] = this;
 }
コード例 #2
0
 // create and initialize a new fish on the specified position of the given world
 public Fish(OptimizedWatorWorld world, Point position, int age)
     : base(world, position)
 {
     Energy = world.InitialFishEnergy;
     Age    = age;
 }
コード例 #3
0
 // create and initialize a shark on the specified position in the given world
 public Shark(OptimizedWatorWorld world, Point position, int energy)
     : base(world, position)
 {
     Energy = energy;
 }