Ejemplo n.º 1
0
 /// <summary>Initializes a new instance of the <see cref="VariableDictionary"/> class.</summary>
 /// <param name="evaluator">The evaluator.</param>
 internal VariableDictionary(MathEvaluator evaluator)
     : base(StringComparer.OrdinalIgnoreCase)
 {
     _evaluator = evaluator;
     base.Add(MathEvaluator.AnswerVariable, 0);
     base.Add("pi", Math.PI);
     base.Add("e", Math.E);
 }
Ejemplo n.º 2
0
Archivo: Calc.cs Proyecto: Crobol/Bot
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing && eval != null)
                {
                    eval.Dispose();
                }

                eval = null;
                disposed = true;
            }
        }
        protected override List<SearchProviderResult> DoSearch(SearchQuery query)
        {
            int priority = SearchProviderResult.PriorityUltraLow;
            var eval = new MathEvaluator();

            if (arr.Any(query.RawQueryString.Contains))
            {
                priority = SearchProviderResult.PriorityHigh;
            }

            double result = eval.Evaluate(query.RawQueryString);
            return ConstructSingleResult(result.ToString(CultureInfo.InvariantCulture), result.ToString(CultureInfo.InvariantCulture), priority);
        }
Ejemplo n.º 4
0
 protected override bool CheckDictionary(string word)
 {
     var eval = new MathEvaluator();
     return target_ == eval.Evaluate(word);
 }
Ejemplo n.º 5
0
 /// <summary>Initializes a new instance of the <see cref="VariableDictionary"/> class.</summary>
 /// <param name="evaluator">The evaluator.</param>
 internal VariableDictionary(MathEvaluator evaluator)
     : base(StringComparer.OrdinalIgnoreCase)
 {
     _evaluator = evaluator;
     AddBase();
 }
Ejemplo n.º 6
0
 public void Setup()
 {
     eval = new MathEvaluator();
 }
Ejemplo n.º 7
0
 public void math(Dictionary<String, dynamic> myDic)
 {
     MathEvaluator eval = new MathEvaluator();
     double e = eval.Evaluate((((String)myDic["text"]).Replace("*math:", "")).Trim());
     General.sc.SendMessage(myDic["channel"], e.ToString() + ", https://www.reddit.com/r/theydidthemath");
 }