public Board(string[] lines) { if (lines.Length != 8) { throw new ArgumentException("Should be exactly 8 lines"); } if (lines.Any(line => line.Length != 8)) { throw new ArgumentException("All lines should have 8 chars length"); } for (var y = 0; y < 8; y++) { var line = lines[y]; if (line == null) { throw new Exception("incorrect input"); } for (var x = 0; x < 8; x++) { var pieceSign = line[x]; var color = char.IsUpper(pieceSign) ? PieceColor.White : PieceColor.Black; Set(new Location(x, y), new ColoredPiece(Piece.FromChar(pieceSign), color)); } } }