Ejemplo n.º 1
0
    public static void Main(string[] args)
    {
        Friend a = new Friend("A");
        Friend b = new Friend("B");
        Friend c = new Friend("C");

        a.AddFriendship(b);
        b.AddFriendship(c);
        Console.WriteLine(a.CanBeConnected(c));
    }
Ejemplo n.º 2
0
        public static void AddFriendsTest()
        {
            try
            {
                Console.WriteLine("Add Friends Test");

                Person p = new Person();
                p.Login("Batman", "test");

                Person t = new Person();
                t.Login("Superman", "pass");

                Person x = new Person();
                x.Login("Wonder Woman", "demigod");

                Person y = new Person();
                y.Login("Wolverine", "WeaponX");

                Person z = new Person();
                z.Login("Ironman", "pep");

                Person a = new Person();
                a.Login("Spiderman", "MJ");

                Friend f = new Friend();
                f.AddFriendship(p, t);
                f.AddFriendship(p, x);
                f.AddFriendship(z, a);
                f.AddFriendship(y, a);
                f.AddFriendship(p, z);

                Console.WriteLine("End of adding friends.\nEnter to continue.\n");
                Console.ReadKey();
            }
            catch
            {
                Console.WriteLine("An error has occured, operations have been stopped");
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            Friend a = new Friend("A");
            Friend b = new Friend("B");
            Friend c = new Friend("C");

            a.AddFriendship(b);
            b.AddFriendship(c);

            //Console.WriteLine(a.CanBeConnected(c));
            Console.WriteLine("MinimalNumberOfPackages: " + Shipping.MinimalNumberOfPackages(16, 2, 10));
            Console.WriteLine("Transform: " + RemoveRepetitions.Transform("abbcbbb"));
        }
Ejemplo n.º 4
0
    public static void Main(string[] args)
    {
        Friend a = new Friend("A");
        Friend b = new Friend("B");
        Friend c = new Friend("C");
        Friend d = new Friend("D");
        Friend e = new Friend("E");

        a.AddFriendship(b);
        a.AddFriendship(c);

        b.AddFriendship(a);
        b.AddFriendship(c);

        c.AddFriendship(a);
        c.AddFriendship(b);

        a.AddFriendship(d);
        d.AddFriendship(e);

        Console.WriteLine(b.CanBeConnected(e, "BFS"));
        Console.WriteLine(b.CanBeConnected(e, "DFS"));
        Console.WriteLine(b.CanBeConnected(e, "BiDirectional"));
    }