/// <summary> /// Compiles the specified string into a pattern, executes it using a custom RNG, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <returns></returns> public Output Do(string input, RNG rng, int charLimit = 0) { return(new Interpreter(this, RantPattern.FromString(input), rng, charLimit).Run()); }
/// <summary> /// Compiles the specified string into a pattern, executes it, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <returns></returns> public Output Do(string input, int charLimit = 0) { return(new Interpreter(this, RantPattern.FromString(input), new RNG(Seeds.NextRaw()), charLimit).Run()); }
/// <summary> /// Compiles the specified string into a pattern, executes it using a custom seed, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="seed">The seed to generate output with.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <returns></returns> public Output Do(string input, long seed, int charLimit = 0) { return(new Interpreter(this, RantPattern.FromString(input), new RNG(seed), charLimit).Run()); }
/// <summary> /// Compiles the specified string into a pattern, executes it using a custom RNG, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public RantOutput Do(string input, RNG rng, int charLimit = 0, double timeout = -1, RantPatternArgs args = null) => RunVM(new Sandbox(this, RantPattern.FromString(input), rng, charLimit, args), timeout);
/// <summary> /// Executes the specified pattern and returns a series of outputs. /// </summary> /// <param name="input">The pattern to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public IEnumerable <RantOutput> DoSerial(string input, RNG rng, int charLimit = 0, double timeout = -1, RantPatternArgs args = null) => new Sandbox(this, RantPattern.FromString(input), rng, charLimit, args).RunSerial(timeout);
/// <summary> /// Compiles the specified string into a pattern, executes it, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <param name="args">The arguments to pass to the pattern.</param> /// <returns></returns> public RantOutput Do(string input, int charLimit = 0, double timeout = -1, RantPatternArgs args = null) => RunVM(new Sandbox(this, RantPattern.FromString(input), new RNG(Seeds.NextRaw()), charLimit, args), timeout);
public static Subroutine FromString(string name, string code, Tuple <string, ParamFlags>[] parameters) { return(new Subroutine(RantPattern.FromString(name, code), parameters)); }
/// <summary> /// Compiles the specified string into a pattern, executes it using a custom RNG, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="rng">The random number generator to use when generating output.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <returns></returns> public RantOutput Do(string input, RNG rng, int charLimit = 0, double timeout = -1) { return(RunVM(new VM(this, RantPattern.FromString(input), rng, charLimit), timeout)); }
/// <summary> /// Compiles the specified string into a pattern, executes it using a custom seed, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="seed">The seed to generate output with.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <returns></returns> public RantOutput Do(string input, long seed, int charLimit = 0, double timeout = -1) { return(RunVM(new VM(this, RantPattern.FromString(input), new RNG(seed), charLimit), timeout)); }
/// <summary> /// Compiles the specified string into a pattern, executes it, and returns the resulting output. /// </summary> /// <param name="input">The input string to execute.</param> /// <param name="charLimit">The maximum number of characters that can be printed. An exception will be thrown if the limit is exceeded. Set to zero or below for unlimited characters.</param> /// <param name="timeout">The maximum number of seconds that the pattern will execute for.</param> /// <returns></returns> public RantOutput Do(string input, int charLimit = 0, double timeout = -1) { return(RunVM(new VM(this, RantPattern.FromString(input), new RNG(Seeds.NextRaw()), charLimit), timeout)); }