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; }
}
精彩评论