开发者

C# World Grid Assistance

开发者 https://www.devze.com 2023-02-25 03:44 出处:网络
I am trying to build a World Grid with Sheep and Wolf ( Predictor Prey Application with Sheep feeding on Grass and Wolf feeding on Sheep ) and I need to build a World Grid and i am not sure which Cl开

I am trying to build a World Grid with Sheep and Wolf ( Predictor Prey Application with Sheep feeding on Grass and Wolf feeding on Sheep ) and I need to build a World Grid and i am not sure which Cl开发者_Go百科ass to choose List or which one? can someone please guide me with the program please?


To make a grid with a fixed size, it's best to use a two-dimensional array. If you world consists of objects of type Place, for instance, you would define this as Place[,] worldGrid = new Place[width, length];.

Place would be a type that might contain sheep or wolves or grass.

enum Organism { Wolf, Sheep, Grass };

class Place
{
  public List<Organism> Inhabitants { get; set; }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消