public Tree(IList <Cell> forest) { var inputs = Console.ReadLine().Split(' '); Index = int.Parse(inputs[0]); Size = (TreeSize)Enum.Parse(typeof(TreeSize), inputs[1]); IsMine = inputs[2] == "1"; IsDormant = inputs[3] == "1"; Richness = forest.First(tree => tree.Index == Index).Richness; }
public Cell() { var inputs = Console.ReadLine().Split(' '); Index = int.Parse(inputs[0]); // 0 is the center cell, the next cells spiral outwards Richness = (CellRichness)Enum.Parse(typeof(CellRichness), inputs[1]); int neigh0 = int.Parse(inputs[2]); // the index of the neighbouring cell for each direction int neigh1 = int.Parse(inputs[3]); int neigh2 = int.Parse(inputs[4]); int neigh3 = int.Parse(inputs[5]); int neigh4 = int.Parse(inputs[6]); int neigh5 = int.Parse(inputs[7]); }