private void MoveTimer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (wait == 0 && progress < 180)
     {
         progress++;
         Point newPos = StartPoint + (Math.Cos(AdvMath.DegreesToRadians(progress)) * StopOffset / 2) + StopOffset / 2;
         movement = newPos - Transform.Position;
         Transform.LocalPosition = newPos;
     }
     else if (wait < Pause && progress == 180)
     {
         wait++;
         movement = new Point();
     }
     else if (wait == Pause && progress > 0)
     {
         progress--;
         Point newPos = StartPoint + (Math.Cos(AdvMath.DegreesToRadians(progress)) * StopOffset / 2) + StopOffset / 2;
         movement = newPos - Transform.Position;
         Transform.LocalPosition = newPos;
     }
     else if (wait > 0 && progress == 0)
     {
         wait--;
         movement = new Point();
     }
 }
Example #2
0
        public async Task Hgm(int deck_size, int hand_size, params int[] nums)
        {
            //double hyper = AdvMath.hgm(deck_size, hand_size, c1, c2, d1, d2);
            if ((nums.Length) % 2 != 0)
            {
                await ReplyAsync($"Input must be even");
            }
            else
            {
                List <int> k = new List <int>();
                List <int> x = new List <int>();

                for (int i = 0; i < nums.Length; i++)
                {
                    if (i < nums.Length / 2)
                    {
                        k.Add(nums[i]);
                    }
                    else
                    {
                        x.Add(nums[i]);
                    }
                }

                double hyper = AdvMath.multihypergeo(x.ToArray(), deck_size, hand_size, k.ToArray());
                await ReplyAsync($"prob = {hyper}");
            }
        }
 public override void BeforeRecieveDamage(Unit attacker, ref int damage)
 {
     if (!attachedUnit.isOutnumbered)
     {
         damage = AdvMath.DivideRoundUp(damage, 2);
     }
 }
Example #4
0
        public void testPythagoreanTheorem()
        {
            var math   = new AdvMath();
            var result = math.calculatePythagoreanTheorem(3, 4);

            Assert.True(result == 5);
        }
Example #5
0
        public void testValueSquared()
        {
            var math   = new AdvMath();
            var result = math.calculateValueSquared(3);

            Assert.True(result == 9);
        }
Example #6
0
        public void testListAverage()
        {
            var math   = new AdvMath();
            var result = math.calculateListAverage(2, 3.5, 4, 7.5);

            Assert.True(result == 4.25);
        }
Example #7
0
        public void testcalculateArea()
        {
            var math   = new AdvMath();
            var result = math.calculateArea(3, 7);

            Assert.True(result == 21);
        }
Example #8
0
        static void Main()
        {
            string[] args = Environment.GetCommandLineArgs();

            /*  foreach(var a in args)
             * {
             *    Console.WriteLine(a);
             * }
             *
             * Console.ReadLine(); */

            AreArgumentsValid(args);

            var Math    = new BasicMath();
            var advMath = new AdvMath();


            switch (_operand.ToString())
            {
            case "add":
                Console.WriteLine($"{_num1} + {_num2} = {Math.addNumbers(_num1, _num2)}");
                break;

            case "sub":
                Console.WriteLine($"{_num1} - {_num2} = {Math.subtractNumbers(_num1, _num2)}");
                break;

            case "mult":
                Console.WriteLine($"{_num1} * {_num2} = {Math.multiplyNumbers(_num1, _num2)}");
                break;

            case "div":
                Console.WriteLine($"{_num1} / {_num2} = {Math.divideNumbers(_num1, _num2)}");
                break;

            case "area":
                Console.WriteLine($"{_num1} * {_num2} H = {advMath.calculateArea(_num1, _num2)}.");
                break;

            case "avg":
                Console.WriteLine($"{_num1}, {_num2}, {_num3}, {_num4} = {advMath.calculateListAverage(_num1, _num2, _num3, _num4)}");
                break;

            case "squared":
                Console.WriteLine($"{_num1}^2 = {advMath.calculateValueSquared(_num1)}");
                break;

            case "pyth":
                Console.WriteLine($"{_num1}^2 + {_num2}^2 = {advMath.calculatePythagoreanTheorem(_num1, _num2)}");
                break;

            default:
                Console.WriteLine($"{_operand} is not a valid operator. Please enter Add, Sub, Mul, Div, area, avg, squared, pyth");
                break;
            }

            Console.ReadLine();
        }
Example #9
0
        public static void Simplyfied(ref int Top, ref int Bottom)
        {
            var res = AdvMath.GCD(Top, Bottom);

            while (res > 1)
            {
                Top    /= res;
                Bottom /= res;
                res     = AdvMath.GCD(Top, Bottom);
            }
        }
Example #10
0
 public void Add(int Duration, int Div)
 {
     if (Division == 0)
     {
         Division = Div;
     }
     if (Div != this.Division)
     {
         var lcm = AdvMath.LCM(Division, Div);
         SummayDuration *= Division / lcm;
         Duration       *= Div / lcm;
     }
     SummayDuration += Duration;
 }
 private double perform_calc(int[] counters)
 {
     return(AdvMath.multihypergeo(counters, population, sample_size, max));
 }
Example #12
0
        public async Task Factorial(int number)
        {
            double fact = AdvMath.factorial(number);

            await ReplyAsync($"{number}! = {fact}");
        }