public State ReadState(InitializationData data) { try { var cells = Enumerable.Range(0, data.Size) .Select(i => readLine().Select(c => c == '.' ? 4 : c - '0').ToArray()) .ToArray(); var myUnits = Enumerable.Range(0, data.UnitsPerPlayer).Select(i => Vec.Parse(readLine())).ToArray(); var hisUnits = Enumerable.Range(0, data.UnitsPerPlayer).Select(i => Vec.Parse(readLine())).ToArray(); // ReSharper disable once UnusedVariable if (logToError) { Console.Error.WriteLine(); } return(new State(cells, new[] { myUnits, hisUnits }, new bool[2], new int[2])); } catch (Exception e) { throw new FormatException($"Line [{lastLine}]", e); } }