Esempio n. 1
0
        public void Evaluate()
        {
            Vincent function = new Vincent();
            Vector  v1       = new Vector(new double[] { 5, 5 });
            Vector  v2       = new Vector(new double[] { 10, 10 });
            Vector  v3       = new Vector(new double[] { 8, 8 });

            Assert.AreEqual(0.7537419467, function.Evaluate(v1), 1e-9);
            Assert.AreEqual(1.7194207255, function.Evaluate(v2), 1e-9);
            Assert.AreEqual(-1.861700698, function.Evaluate(v3), 1e-9);
        }
Esempio n. 2
0
            public static void CreateMobiles(Point3D pointLocation, Map mapLocation)
            {
                Point3D theDrunk  = new Point3D(3736, 2220, 20);
                Point3D vincent   = new Point3D(1545, 1768, 10);
                Point3D linda     = new Point3D(2710, 2106, 0);
                Point3D boyfriend = new Point3D(2712, 2104, 0);

                if (!FindMobile(mapLocation, pointLocation))
                {
                    TheDrunk        td = new TheDrunk();
                    Vincent         v  = new Vincent();
                    Linda           l  = new Linda();
                    LindasBoyfriend bf = new LindasBoyfriend();

                    if (pointLocation == theDrunk)
                    {
                        td.Direction = Direction.East;
                        td.Location  = pointLocation;
                        td.Map       = mapLocation;
                        World.AddMobile(td);
                    }

                    if (pointLocation == vincent)
                    {
                        v.Direction = Direction.North;
                        v.Location  = pointLocation;
                        v.Map       = mapLocation;
                        World.AddMobile(v);
                    }

                    if (pointLocation == boyfriend)
                    {
                        bf.Direction = Direction.South;
                        bf.Location  = pointLocation;
                        bf.Map       = mapLocation;
                        World.AddMobile(bf);
                    }

                    if (pointLocation == linda)
                    {
                        l.Direction = Direction.East;
                        l.Location  = pointLocation;
                        l.Map       = mapLocation;
                        World.AddMobile(l);
                    }

                    l.BoyFriend = bf;
                }
            }
Esempio n. 3
0
        public void SaveToFile(string path)
        {
            using (StreamWriter sw = new StreamWriter(path))
                using (XmlWriter writer = XmlWriter.Create(sw, Resource.XmlWriterSettings))
                {
                    writer.WriteStartElement("party");

                    writer.WriteStartElement("characters");
                    Cloud.WriteToXml(writer);
                    Tifa.WriteToXml(writer);
                    Barret.WriteToXml(writer);
                    Aeris.WriteToXml(writer);
                    RedXIII.WriteToXml(writer);
                    CaitSith.WriteToXml(writer);
                    Yuffie.WriteToXml(writer);
                    Vincent.WriteToXml(writer);
                    Cid.WriteToXml(writer);
                    Sephiroth.WriteToXml(writer);
                    writer.WriteEndElement(); // characters

                    for (int i = 0; i < PARTY_SIZE; i++)
                    {
                        writer.WriteElementString("slot" + i, this[i].Name);
                    }

                    foreach (Character c in Reserves)
                    {
                        if (c != null)
                        {
                            writer.WriteElementString("reserve", c.Name);
                        }
                    }

                    Inventory.WriteToXml(writer);
                    Materiatory.WriteToXml(writer);

                    writer.WriteElementString("gil", Gil.ToString());
                    writer.WriteElementString("time", Clock.TotalMilliseconds.ToString());

                    writer.WriteStartElement("config");
                    writer.WriteStartElement("menu");

                    for (int i = 0; i < 4; i++)
                    {
                        int r, g, b;

                        Menu.Menu.GetCornerColor(i, out r, out g, out b);

                        writer.WriteStartElement("corner" + i.ToString());
                        writer.WriteAttributeString("r", r.ToString());
                        writer.WriteAttributeString("g", g.ToString());
                        writer.WriteAttributeString("b", b.ToString());
                        writer.WriteEndElement(); // corner
                    }

                    writer.WriteEndElement(); // menu
                    writer.WriteEndElement(); // config

                    writer.WriteEndElement(); // party
                }
        }
Esempio n. 4
0
        public void SimpleSubtractTest3()
        {
            int result = Vincent.Subtract(11, 1);

            Assert.AreEqual(10, result);
        }
Esempio n. 5
0
        public void SimpleSubtractTest2()
        {
            int result = Vincent.Subtract(10, 3);

            Assert.AreEqual(7, result);
        }
Esempio n. 6
0
        public void SimpleSubtractTest()
        {
            int result = Vincent.Subtract(5, 4);

            Assert.AreEqual(1, result);
        }
Esempio n. 7
0
        public void SimpleAddTest()
        {
            int result = Vincent.Add(1, 2);

            Assert.AreEqual(3, result);
        }