static void TestList()
        {
            var list = UNSHIFT(
                UNSHIFT(
                    UNSHIFT(EMPTY)(THREE)
                    )(TWO)
                )(ONE);

            var list1 = build_list(ONE, TWO, THREE);

            Console.WriteLine(to_integer(FIRST(list)));
            Console.WriteLine(to_integer(FIRST(list1)));

            Console.WriteLine(to_integer(FIRST(REST(list))));
            Console.WriteLine(to_integer(FIRST(REST(list1))));

            Console.WriteLine(to_integer(FIRST(REST(REST(list)))));
            Console.WriteLine(to_integer(FIRST(REST(REST(list1)))));

            Console.WriteLine(to_boolean(IS_EMPTY(list)));
            Console.WriteLine(to_boolean(IS_EMPTY(list1)));

            Console.WriteLine(to_boolean(IS_EMPTY(EMPTY)));

            print_int_list(list1);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            count_f1.Text = "0";
            count_f2.Text = "0";
            count_f3.Text = "0";
            count_f4.Text = "0";
            count_f5.Text = "0";

            for (int i = 0; i < Garfo.Count(); i++)
            {
                Garfo[i].EstaEmUso        = false;
                Filosofos[i].EstaPensando = false;
            }

            controlaThreads = true;

            F1.Abort();
            F2.Abort();
            F3.Abort();
            F4.Abort();
            F5.Abort();

            { F1 = new Thread(Filosofo1); F1.Start(); }
            { F3 = new Thread(Filosofo3); F3.Start(); }
            { F5 = new Thread(Filosofo5); F5.Start(); }
            { F2 = new Thread(Filosofo2); F2.Start(); }
            { F4 = new Thread(Filosofo4); F4.Start(); }
            button1.Enabled = false;
            button2.Enabled = true;
        }
    protected virtual void OnTrackingFound()
    {
        if (mTrackableBehaviour)
        {
            var rendererComponents = mTrackableBehaviour.GetComponentsInChildren <Renderer>(true);
            var colliderComponents = mTrackableBehaviour.GetComponentsInChildren <Collider>(true);
            var canvasComponents   = mTrackableBehaviour.GetComponentsInChildren <Canvas>(true);

            // Enable rendering:
            foreach (var component in rendererComponents)
            {
                component.enabled = true;
            }

            // Enable colliders:
            foreach (var component in colliderComponents)
            {
                component.enabled = true;
            }

            // Enable canvas':
            foreach (var component in canvasComponents)
            {
                component.enabled = true;
            }
        }

        if (mTrackableBehaviour.TrackableName == "E1")
        {
            F1.SetActive(true);
            F2.SetActive(true);
            F3.SetActive(true);
            F4.SetActive(true);
        }
    }
Esempio n. 4
0
        private void IniciarBotao(object sender, EventArgs e)
        {
            Contador1.Text = "0";
            Contador2.Text = "0";
            Contador3.Text = "0";
            Contador4.Text = "0";
            Contador5.Text = "0";

            for (int i = 0; i < Garfo.Count(); i++)
            {
                Garfo[i].EmUso       = false;
                Filosofo[i].Pensando = false;
            }

            ControleThread = true;

            F1.Abort();
            F2.Abort();
            F3.Abort();
            F4.Abort();
            F5.Abort();

            { F1 = new Thread(Filosofo1); F1.Start(); }
            { F3 = new Thread(Filosofo3); F3.Start(); }
            { F5 = new Thread(Filosofo5); F5.Start(); }
            { F2 = new Thread(Filosofo2); F2.Start(); }
            { F4 = new Thread(Filosofo4); F4.Start(); }


            iniciar.Enabled   = false;
            Finalizar.Enabled = true;
        }
Esempio n. 5
0
 public void Start()
 {
     cli1_1.text = "";
     cli2_1.text = "";
     cli1_2.text = "";
     cli2_2.text = "";
     cli1_3.text = "";
     cli2_3.text = "";
     cli1_4.text = "";
     cli2_4.text = "";
     cli1_5.text = "";
     cli2_5.text = "";
     F1.SetActive(false);
     H1.SetActive(false);
     H11.SetActive(false);
     F2.SetActive(false);
     H2.SetActive(false);
     H22.SetActive(false);
     F3.SetActive(false);
     H3.SetActive(false);
     H33.SetActive(false);
     F4.SetActive(false);
     H4.SetActive(false);
     H44.SetActive(false);
     F5.SetActive(false);
     H5.SetActive(false);
     H55.SetActive(false);
 }
Esempio n. 6
0
        static void Main(string[] args)
        {
            F1 f1 = new F1();

            f1.print();
            F2 f2 = new F2();

            f2.print();
            F3 f3 = new F3();

            f3.print();
            F4 f4 = new F4();

            f4.print();
            F5 f5 = new F5();

            f5.print();
            F6 f6 = new F6();

            f6.print();
            F7 f7 = new F7();

            f7.print();
            F8 f8 = new F8();

            f8.print();
            F9 f9 = new F9();

            f9.print();
        }
Esempio n. 7
0
        public IntegerPolynomial ToIntegerPolynomial()
        {
            IntegerPolynomial i = F1.Multiply(F2.ToIntegerPolynomial());

            i.Add(F3.ToIntegerPolynomial());
            return(i);
        }
Esempio n. 8
0
        public void Run()
        {
            var function = new F3();

            // var function = new DelegateFunction(x => Math.Pow(x[0] - 3, 2));

            for (int i = 10; i <= 15; i++)
            {
                // Coordinate descent method
                var opt1 = new CoordinateDescentMinimizer();
                opt1.IsOutputPerIterationEnabled = false;
                opt1.Minimize(function, new double[] { i });

                // Golden section search
                var opt2 = new GoldenSectionMinimizer();
                opt2.IsOutputPerIterationEnabled = false;
                opt2.Minimize(function, i);

                // Nelder-Mead search
                var opt3 = new NelderMeadMinimizer();
                opt3.IsOutputPerIterationEnabled = false;
                opt3.Minimize(function, new double[] { i });

                // Hooke-Jeeves pattern search
                var opt4 = new HookeJeevesMinimizer();
                opt4.IsOutputPerIterationEnabled = false;
                opt4.Minimize(function, new double[] { i });
            }
        }
Esempio n. 9
0
 private void A1_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5M^7ain ^5M^7enu\n\n^2-->^5Host Menu\nClient 1 Menu\nReset Menu\nAccount Menu\nTeleport Menu\nVision Menu\nCredit Menu\n\n\n^3Client 0 : ^2" + textBox1.Text + "\n^3Client 1 : ^2" + textBox2.Text + "^5");
     if (Key_IsDown((uint)0) == "X")
     {
         HostMenuMain.Stop();
         B1.Start();
     }
     if (Key_IsDown((uint)0) == "R1")
     {
         HostMenuMain.Stop();
         Client1.Start();
     }
     if (Key_IsDown((uint)0) == "R3 + L3")
     {
         HostMenuMain.Stop();
         B1.Stop();
         B2.Stop();
         B3.Stop();
         B4.Stop();
         B5.Stop();
         Client1.Stop();
         C1.Stop();
         C2.Stop();
         C3.Stop();
         C4.Stop();
         ResetMenu.Stop();
         D1.Stop();
         D2.Stop();
         D3.Stop();
         D4.Stop();
         D5.Stop();
         AccountMenu.Stop();
         E1.Stop();
         E2.Stop();
         E3.Stop();
         E4.Stop();
         E5.Stop();
         TeleportMenu.Stop();
         F1.Stop();
         F2.Stop();
         F3.Stop();
         F4.Stop();
         VisionMenu.Stop();
         G1.Stop();
         G2.Stop();
         G3.Stop();
         G4.Stop();
         G5.Stop();
         G6.Stop();
         OtherMenu.Stop();
         H1.Stop();
         PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed");
         simpleButton2.Enabled           = true;
         toolStripStatusLabel2.Text      = "Not Started !";
         toolStripStatusLabel2.ForeColor = Color.Red;
         simpleButton3.Enabled           = false;
     }
 }
Esempio n. 10
0
        public IntegerPolynomial Multiply(IntegerPolynomial b)
        {
            IntegerPolynomial c = F1.Multiply(b);

            c = F2.Multiply(c);
            c.Add(F3.Multiply(b));
            return(c);
        }
Esempio n. 11
0
        public BigIntPolynomial Multiply(BigIntPolynomial b)
        {
            BigIntPolynomial c = F1.Multiply(b);

            c = F2.Multiply(c);
            c.Add(F3.Multiply(b));
            return(c);
        }
Esempio n. 12
0
        private void Filosofo3()
        {
            int tempo        = sorteio.Next(3000, 6000);
            int TempoComendo = tempo / Controlatempo;

            while (ControleThread)
            {
                if (Garfo[1].EmUso == true || Garfo[2].EmUso == true)
                {
                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        ListaTela.Items.Add(Filosofo[2].Nome + " está pensando");
                        Status3.Text = "Pensando";
                    });

                    Thread.Sleep(2000);
                }
                else
                {
                    Semaforo.WaitOne();
                    {
                        Filosofo[0].Pensando = false;
                        Garfo[0].EmUso       = true;
                        Garfo[4].EmUso       = true;

                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            ListaTela.Items.Add(Filosofo[2].Nome + " está  comendo");
                            Status3.Text = "Comendo";
                            ContadorFilosofo3++;

                            Contador3.Text = ContadorFilosofo3.ToString();
                        });


                        Thread.Sleep(TempoComendo);

                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            ListaTela.Items.Add(Filosofo[2].Nome + " está  pensando");
                            Status3.Text = "Pensando";
                        });


                        Filosofo[2].Pensando = true;
                        Garfo[1].EmUso       = false;
                        Garfo[2].EmUso       = false;
                    }
                    Semaforo.Release();
                    if (ContadorFilosofo3 == 5)
                    {
                        F3.Abort();
                        return;
                    }
                }
            }
        }
        static void TestPair()
        {
            var pair = PAIR(ONE)(TWO);

            Console.WriteLine(to_integer(LEFT(pair)));
            Console.WriteLine(to_integer(RIGHT(pair)));
            Console.WriteLine(to_integer(ONE));
            Console.WriteLine(to_integer(TWO));
        }
        static void DoFizzBuzz()
        {
            var f = MAP(RANGE(ONE)(HUNDRED))((F1)(n =>
                                                  IF(IS_ZERO(MOD(n)(FIFTEEN)))(
                                                      FIZZBUZZ
                                                      )(IF(IS_ZERO(MOD(n)(THREE)))(
                                                            FIZZ
                                                            )(IF(IS_ZERO(MOD(n)(FIVE)))(
                                                                  BUZZ
                                                                  )(
                                                                  MAP(TO_DIGITS(n))(NUM2CHAR)
                                                                  )))));

            List <dynamic> string_list = to_list(f);

            string_list
            .ToList()
            .ForEach(s => print_string(s));
        }
Esempio n. 15
0
        public override int GetHashCode()
        {
            const int prime  = 31;
            int       result = 1;

            result = prime * result + ((F1 == null) ? 0 : F1.GetHashCode());
            result = prime * result + ((F2 == null) ? 0 : F2.GetHashCode());
            result = prime * result + ((F3 == null) ? 0 : F3.GetHashCode());
            return(result);
        }
 protected virtual void Start()
 {
     mTrackableBehaviour = GetComponent <TrackableBehaviour>();
     if (mTrackableBehaviour)
     {
         mTrackableBehaviour.RegisterTrackableEventHandler(this);
     }
     F1.SetActive(false);
     F2.SetActive(false);
     F3.SetActive(false);
     F4.SetActive(false);
 }
Esempio n. 17
0
        public byte[] ToBinary()
        {
            byte[] f1Bin = F1.ToBinary();
            byte[] f2Bin = F2.ToBinary();
            byte[] f3Bin = F3.ToBinary();

            byte[] all = new byte[f1Bin.Length + f2Bin.Length + f3Bin.Length];
            Array.Copy(f1Bin, all, f1Bin.Length);
            Array.Copy(f2Bin, 0, all, f1Bin.Length, f2Bin.Length);
            Array.Copy(f3Bin, 0, all, (f1Bin.Length + f2Bin.Length), f3Bin.Length);
            return(all);
        }
Esempio n. 18
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            ProductFormPolynomial other = (ProductFormPolynomial)obj;

            if (F1 == null)
            {
                if (other.F1 != null)
                {
                    return(false);
                }
            }
            else if (!F1.Equals(other.F1))
            {
                return(false);
            }
            if (F2 == null)
            {
                if (other.F2 != null)
                {
                    return(false);
                }
            }
            else if (!F2.Equals(other.F2))
            {
                return(false);
            }
            if (F3 == null)
            {
                if (other.F3 != null)
                {
                    return(false);
                }
            }
            else if (!F3.Equals(other.F3))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 19
0
        public static void Main(string[] args)
        {
            Console.WriteLine(eval(x => x * x, 3));

            //Private Anonym
            F2 f2 = (a, b, c) => (a + b + c);

            Console.WriteLine(f2(1, 2, 3));

            F3 f3 = (x, a, b) => a <= x && b >= x;

            Console.WriteLine(f3(2, 1, 4));
            Console.WriteLine(f3(1, 2, 3));
        }
        static void Main(string[] args)
        {
            var f1 = new F1 {
                F2 = new F2 {
                    Name = "Test"
                }, Q = 10
            };
            var f3 = new F3 {
                F2 = new F2()
            };

            Copier.Copy(f1, f3, "Q");
            Copier.Copy(f1, f3, "F2.Name");
        }
Esempio n. 21
0
 private void simpleButton3_Click(object sender, EventArgs e)
 {
     MainMenu.Stop();
     HostMenuMain.Stop();
     B1.Stop();
     B2.Stop();
     B3.Stop();
     B4.Stop();
     B5.Stop();
     Client1.Stop();
     C1.Stop();
     C2.Stop();
     C3.Stop();
     C4.Stop();
     ResetMenu.Stop();
     D1.Stop();
     D2.Stop();
     D3.Stop();
     D4.Stop();
     D5.Stop();
     AccountMenu.Stop();
     E1.Stop();
     E2.Stop();
     E3.Stop();
     E4.Stop();
     E5.Stop();
     TeleportMenu.Stop();
     F1.Stop();
     F2.Stop();
     F3.Stop();
     F4.Stop();
     VisionMenu.Stop();
     G1.Stop();
     G2.Stop();
     G3.Stop();
     G4.Stop();
     G5.Stop();
     G6.Stop();
     OtherMenu.Stop();
     H1.Stop();
     PS3.Extension.WriteString(0x004eb39c, "^5Menu ^1Closed");
     toolStripStatusLabel2.Text      = "Not Started !";
     toolStripStatusLabel2.ForeColor = Color.Red;
     simpleButton2.Enabled           = true;
     simpleButton3.Enabled           = false;
 }
Esempio n. 22
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            F1.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F1.FileName.ToString());
            F2.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F2.FileName.ToString());
            F3.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F3.FileName.ToString());
            F4.SaveAs(Request.PhysicalApplicationPath + ".//" + F4.FileName.ToString());
            a = "Product_img/" + F1.FileName.ToString();
            b = "Product_img/" + F2.FileName.ToString();
            c = "Product_img/" + F3.FileName.ToString();
            d = "" + F4.FileName.ToString();
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into laptop values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + b.ToString() + "','" + c.ToString() + "','" + a.ToString() + "','" + d.ToString() + "')";
            cmd.ExecuteNonQuery();
            con.Close();
        }
        /// <summary>
        /// Gets Besselian elements values for specified Juluan Day.
        /// </summary>
        /// <param name="jd">Julian Day of interest.</param>
        /// <returns>Besselian elements for the given instant.</returns>
        public InstantLunarEclipseElements GetInstantBesselianElements(double jd)
        {
            //if (jd < From || jd > To)
            //    throw new ArgumentException($"Polynomial Besselian elements valid only for Julian Day in range [{From} ... {To}].", nameof(jd));

            // difference, with t0, in step units
            double t = (jd - JulianDay0) / Step;

            return(new InstantLunarEclipseElements()
            {
                JulianDay = jd,
                DeltaT = DeltaT,
                X = X.Select((x, n) => x * Pow(t, n)).Sum(),
                Y = Y.Select((y, n) => y * Pow(t, n)).Sum(),
                F1 = F1.Select((y, n) => y * Pow(t, n)).Sum(),
                F2 = F2.Select((y, n) => y * Pow(t, n)).Sum(),
                F3 = F3.Select((y, n) => y * Pow(t, n)).Sum(),
                Alpha = To360(Alpha.Select((y, n) => y * Pow(t, n)).Sum()),
                Delta = Delta.Select((y, n) => y * Pow(t, n)).Sum(),
            });
        }
Esempio n. 24
0
        public static void Main(string[] args)
        {
            //====================== DELEGATE
            Funktion f0  = inputDouble => inputDouble * inputDouble;
            double   res = f0(2);

            F2 f2 = (a, b, c) => (a + b + c);

            res = f2(1, 2, 3);

            //ist x zwischen a & b ?
            F3 f3 = (x, a, b) => a <= x && b >= x;

            f4 = (d, d1) =>
            {
                return(Convert.ToInt32(d * d1));
            };


            //======================= ANONYMER-STUFF
            // this is an anonymous class, containing two integers
            int x_Value = 1;
            var p1      = new { x_Value = 1, y = 2 };
            var p2      = p1;

            //======================= LAMBDA-SPECIAL-STUFF
            //Vergleich in kurz für Sort
            Comparison <string> sortBy = (a, b) => (a.Length > b.Length) ? -1 : 1;

            var words = new List <string> {
                "This", "is", "one", "simple", "list."
            };

            words.Sort(sortBy);
            words.Sort((a, b) => a.CompareTo(b));
        }
Esempio n. 25
0
 private void F4_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5T^7eleport ^5M^7enu^5\n\nKill\nDown the map\nBack to map\n^2-->^5Sky");
     if (Key_IsDown((uint)0) == "R1")
     {
         F4.Stop();
         F1.Start();
     }
     if (Key_IsDown((uint)0) == "X")
     {
         byte[] buffer = new byte[] { 0x44, 0x2E, 0xF9, 0x9A, 0x43, 0xCC, 0xE6, 0x66, 0x45, 0x0E, 0x63, 0xAD, 0x00 };
         PS3.SetMemory(0x012272F4, buffer);
     }
     if (Key_IsDown((uint)0) == "R3")
     {
         F4.Stop();
         HostMenuMain.Start();
     }
     if (Key_IsDown((uint)0) == "L1")
     {
         F4.Stop();
         F3.Start();
     }
 }
Esempio n. 26
0
 private void F2_Tick(object sender, EventArgs e)
 {
     PS3.Extension.WriteString(0x004eb39c, "^5S^7pec Ops ^5M^7od Menu ^5B^7y ^5M^7rNiato - ^5T^7eleport ^5M^7enu^5\n\nKill\n^2-->^5Down the map\nBack to map\nSky");
     if (Key_IsDown((uint)0) == "R1")
     {
         F2.Stop();
         F3.Start();
     }
     if (Key_IsDown((uint)0) == "X")
     {
         byte[] buffer = new byte[] { 0x43, 0xBB, 0xB8, 0x47, 0x42, 0x66, 0x0B, 0xFD, 0xC2, 0xD3, 0xC0, 0x02, 0x00 };
         PS3.SetMemory(0x012272F4, buffer);
     }
     if (Key_IsDown((uint)0) == "R3")
     {
         F2.Stop();
         HostMenuMain.Start();
     }
     if (Key_IsDown((uint)0) == "L1")
     {
         F2.Stop();
         F1.Start();
     }
 }
Esempio n. 27
0
    public void ClearMenuAttempts()
    {
        F1.SetActive(false);
        H1.SetActive(false);
        H11.SetActive(false);
        F2.SetActive(false);
        H2.SetActive(false);
        H22.SetActive(false);
        F3.SetActive(false);
        H3.SetActive(false);
        H33.SetActive(false);
        F4.SetActive(false);
        H4.SetActive(false);
        H44.SetActive(false);
        F5.SetActive(false);
        H5.SetActive(false);
        H55.SetActive(false);

        cli1_1.SetText(""); cli2_1.SetText("");
        cli1_2.SetText(""); cli2_2.SetText("");
        cli1_3.SetText(""); cli2_3.SetText("");
        cli1_4.SetText(""); cli2_4.SetText("");
        cli1_5.SetText(""); cli2_5.SetText("");
    }
Esempio n. 28
0
        private void runForm3()
        {
            PlayerL p = new PlayerL();

            p.lista = plData.getList();

            Form F3;

            // RequestStop();
            thread.Abort();
            if (server)
            {
                F3 = new Form3(pl, this.Location, server, ss, p);
            }
            else
            {
                F3 = new Form3(pl, this.Location, server, cc);
            }

            HideMe();
            F3.Enabled = true;
            F3.Visible = true;
            F3.Show();
        }
Esempio n. 29
0
 public void Continue <T, U, V, W, R>(F3 <T, U, V, W, R> m)
 {
     PrivateContinue(m);
 }
Esempio n. 30
0
 public void Spawn <T, U, V, W, R>(F3 <T, U, V, W, R> m)
 {
     PrivateSpawn(m);
 }