public ActionField(int height, int width, int cookiesCount) { Height = height; Width = width; Nodes = new FieldNodes(width, height); InitializeFieldRandomly(cookiesCount); }
public ActionField(string[] fieldPrototype) { Height = fieldPrototype.Length; Width = fieldPrototype[1].Length; Nodes = new FieldNodes(Width, Height); foreach (var fieldNode in Nodes) { var nodeLetter = fieldPrototype[fieldNode.Point.Y][fieldNode.Point.X]; var nodeType = NodeType.Gross; switch (nodeLetter) { case ' ': nodeType = NodeType.Gross; break; case 'A': nodeType = NodeType.Agent; break; case 'F': nodeType = NodeType.Star; break; case 'C': nodeType = NodeType.Cookie; break; case '#': nodeType = NodeType.Rock; break; } fieldNode.NodeType = nodeType; } }
public ActionField(int height, int width) { Height = height; Width = width; Nodes = new FieldNodes(width, height); }