Ejemplo n.º 1
0
        //  [STAThread]
        public static void Main(String[] args)
        {
            data[0] = new ClientData("akka.tcp://client1@localhost:", 1111, "/user/GameActor", 1, "client1");
            data[1] = new ClientData("akka.tcp://client2@localhost:", 2222, "/user/GameActor", 2, "client2");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            clientClass = new ClientClass(data, "client1");
            clientItem  = clientClass.initializeClient(0, data.Length);

            t1 = new Test();
            t1.setNumPlayer(data.Length);


            // line = Console.ReadLine();
            line = "";
            //System.Threading.Thread.Sleep(5000);

            while (line != null)
            {
                line = Console.ReadLine();
                if (line == "start")
                {
                    clientAlcatraz = clientItem.getAlcatraz();
                    clientItem.getAlcatraz().showWindow();
                    clientAlcatraz.addMoveListener(t1);
                    clientItem.getAlcatraz().getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                    clientItem.getAlcatraz().start();
                    Application.Run();
                }
            }
        }
Ejemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Test t1 = new Test();
            Test t2 = new Test();
            // 1       Test t3 = new Test();

            Alcatraz a1 = new Alcatraz();
            Alcatraz a2 = new Alcatraz();

            //        Alcatraz a3 = new Alcatraz();

            t1.setNumPlayer(2);
            t2.setNumPlayer(2);
            //        t1.setNumPlayer(3);
            //        t2.setNumPlayer(3);
            //        t3.setNumPlayer(3);

            a1.init(2, 0);
            a2.init(2, 1);
            //        a1.init(3, 0);
            //        a2.init(3, 1);
            //        a3.init(3, 2);

            a1.getPlayer(0).Name = "Player 1";
            a1.getPlayer(1).Name = "Player 2";
            //a1.getPlayer(2).Name = "Player 3";
            a2.getPlayer(0).Name = "Player 1";
            a2.getPlayer(1).Name = "Player 2";
            //a2.getPlayer(2).Name = "Player 3";
            //a3.getPlayer(0).Name = "Player 1";
            //a3.getPlayer(1).Name = "Player 2";
            //a3.getPlayer(2).Name = "Player 3";

            t1.setOther(0, a2);
            //        t1.setOther(1, a3);
            t2.setOther(0, a1);
            //        t2.setOther(1, a3);
            //        t3.setOther(0, a1);
            //        t3.setOther(1, a2);

            a1.showWindow();
            a1.addMoveListener(t1);
            a2.showWindow();
            a2.addMoveListener(t2);
            //        a3.showWindow();
            //        a3.addMoveListener(t3);

            a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
            a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
            //a3.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);

            a1.start();
            a2.start();
            //        a3.start();
            Application.Run();
        }
Ejemplo n.º 3
0
        //  [STAThread]
        public static void Main(String[] args)
        {
            string actorSystemName = "client2";

            Console.Title = actorSystemName;

            var actorSystem    = ActorSystem.Create(actorSystemName);
            var localChatActor = actorSystem.ActorOf(Props.Create <GameActor>(), "GameActor");

            child = actorSystem.ActorOf(Props.Create <GameActor>(), "GameActorClient2Child");
            string remoteActorAddressClient1 = "akka.tcp://client1@localhost:1111/user/GameActor";

            remoteChatActorClient1 = actorSystem.ActorSelection(remoteActorAddressClient1);

            data    = new ClientData[1];
            data[0] = new ClientData("akka.tcp://client1@localhost:", 1111, "/user/GameActor", 1, "client1");
            other   = new Alcatraz[data.Length + 1];

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            clientClass = new ClientClass(data, "client2");
            clientItem  = clientClass.initializeClient(1, data.Length + 1, data, "client2");
            // loop here and sent to other
            if (clientItem != null)
            {
                string line = string.Empty;
                while (line != null && line != "received")
                {
                    line = Console.ReadLine();
                    remoteChatActorClient1.Tell(clientItem, child);
                }
            }
            t1 = new Test();
            t1.setNumPlayer(data.Length + 1);


            // line = Console.ReadLine();
            line = "";
            //System.Threading.Thread.Sleep(5000);

            while (line != null)
            {
                line = Console.ReadLine();
                if (line == "start")
                {
                    clientAlcatraz = clientItem.getAlcatraz();
                    clientItem.getAlcatraz().showWindow();
                    clientAlcatraz.addMoveListener(t1);
                    clientItem.getAlcatraz().getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                    clientItem.getAlcatraz().start();
                    Application.Run();
                }
            }
        }
Ejemplo n.º 4
0
        static void Main()
        {
            //++++++++++++++++++++++++++++++++
            //+++++ ANBINDUNG ZUM SERVER +++++
            //++++++++++++++++++++++++++++++++

            /*
             * Console.WriteLine("To cancel the registration enter 'delete'");
             * Console.WriteLine("Please choose a player name:");
             * playerName = Console.ReadLine();
             *
             * while (playerName == "")
             * {
             *  Console.WriteLine("Your name cannot be empty. Please choose a player name:");
             *  playerName = Console.ReadLine();
             * }
             * try
             * {
             *  //startActorSystem("alcatraz");
             *
             *  // Setup an actor that will handle deadletter type messages
             *  var deadletterWatchMonitorProps = Props.Create(() => new DeadletterMonitor());
             *  var deadletterWatchActorRef = Globals.ActSys.ActorOf(deadletterWatchMonitorProps, "DeadLetterMonitoringActor");
             *
             *  // subscribe to the event stream for messages of type "DeadLetter"
             *  Globals.ActSys.EventStream.Subscribe(deadletterWatchActorRef, typeof(DeadLetter));
             *
             *  var localChatActor = Globals.ActSys.ActorOf(Props.Create<GameActor>(), "GameActor");
             *
             *  string remoteActorAddressClient1 = "akka.tcp://[email protected]:5555/user/RegisterActor";
             *  var remoteChatActorClient1 = Globals.ActSys.ActorSelection(remoteActorAddressClient1);
             *
             *  if (remoteChatActorClient1 != null)
             *  {
             *
             *      remoteChatActorClient1.Tell(playerName, localChatActor);
             *
             *      string line = string.Empty;
             *          while (line != null) {
             *              line = Console.ReadLine();
             *
             *              if(line == "delete")
             *          {
             *              remoteChatActorClient1.Tell("delete|" + playerName, localChatActor);
             *          }
             *      }
             *
             *      } else {
             *      Console.WriteLine("Could not get remote actor ref");
             *      Console.ReadLine();
             *  }
             * }
             * catch (Exception ex)
             * {
             *  Console.WriteLine(ex);
             * }
             */
            //ANBINDUNG ZUM SERRVER - end

            Globals.myName = "Palo";

            string testJSON = @"[
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5248,""actorName"":""ReceivingActor"",""playerId"":0,""playerName"":""Franz""},
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5249,""actorName"":""ReceivingActor"",""playerId"":1,""playerName"":""Bashar""}
            ]";


            string testJSON3 = @"[
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5248,""actorName"":""ReceivingActor"",""playerId"":0,""playerName"":""Franz""},
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5249,""actorName"":""ReceivingActor"",""playerId"":1,""playerName"":""Bashar""},
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5250,""actorName"":""ReceivingActor"",""playerId"":2,""playerName"":""Indrit""}
            ]";

            string testJSON4 = @"[
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5248,""actorName"":""ReceivingActor"",""playerId"":0,""playerName"":""Franz""},
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5249,""actorName"":""ReceivingActor"",""playerId"":1,""playerName"":""Bashar""},
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5250,""actorName"":""ReceivingActor"",""playerId"":2,""playerName"":""Indrit""},
                {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5251,""actorName"":""ReceivingActor"",""playerId"":3,""playerName"":""Palo""}
            ]";

            Globals.AllPlayers = JsonConvert.DeserializeObject <List <ClientData> >(testJSON4);
            foreach (var item in Globals.AllPlayers)
            {
                if (item.playerName == Globals.myName)
                {
                    Globals.myPlayerId = item.playerId;
                    //break;
                }
                else
                {
                    //Console.WriteLine(item.ToString());
                    Globals.remoteActorAddresses.Add(item.ToString());
                }
            }

            if (Globals.AllPlayers.Count == 2)
            {
                Game     t1 = new Game();
                Game     t2 = new Game();
                Alcatraz a1 = new Alcatraz();
                Alcatraz a2 = new Alcatraz();
                t1.setNumPlayer(Globals.AllPlayers.Count);
                t2.setNumPlayer(Globals.AllPlayers.Count);
                a1.init(2, 0);
                a2.init(2, 1);
                a1.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a1.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a2.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a2.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                t1.setOther(0, a2);
                t2.setOther(0, a1);
                if (Globals.myPlayerId == 0)
                {
                    a1.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a1), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 1)
                {
                    a2.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a2), "ReceivingActor");
                }
                a1.addMoveListener(t1);
                a2.addMoveListener(t2);
                a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a1.start();
                a2.start();
            }
            else if (Globals.AllPlayers.Count == 3)
            {
                Game     t1 = new Game();
                Game     t2 = new Game();
                Game     t3 = new Game();
                Alcatraz a1 = new Alcatraz();
                Alcatraz a2 = new Alcatraz();
                Alcatraz a3 = new Alcatraz();
                t1.setNumPlayer(Globals.AllPlayers.Count);
                t2.setNumPlayer(Globals.AllPlayers.Count);
                t3.setNumPlayer(Globals.AllPlayers.Count);
                a1.init(3, 0);
                a2.init(3, 1);
                a3.init(3, 2);
                a1.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a1.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a1.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a2.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a2.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a2.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a3.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a3.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a3.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                t1.setOther(0, a2);
                t1.setOther(1, a3);
                t2.setOther(0, a1);
                t2.setOther(1, a3);
                t3.setOther(0, a1);
                t3.setOther(1, a2);
                if (Globals.myPlayerId == 0)
                {
                    a1.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a1), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 1)
                {
                    a2.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a2), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 2)
                {
                    a3.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a3), "ReceivingActor");
                }
                a1.addMoveListener(t1);
                a2.addMoveListener(t2);
                a3.addMoveListener(t3);
                a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a3.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a1.start();
                a2.start();
                a3.start();
            }
            else if (Globals.AllPlayers.Count == 4)
            {
                Game     t1 = new Game();
                Game     t2 = new Game();
                Game     t3 = new Game();
                Game     t4 = new Game();
                Alcatraz a1 = new Alcatraz();
                Alcatraz a2 = new Alcatraz();
                Alcatraz a3 = new Alcatraz();
                Alcatraz a4 = new Alcatraz();
                t1.setNumPlayer(Globals.AllPlayers.Count);
                t2.setNumPlayer(Globals.AllPlayers.Count);
                t3.setNumPlayer(Globals.AllPlayers.Count);
                t4.setNumPlayer(Globals.AllPlayers.Count);
                a1.init(4, 0);
                a2.init(4, 1);
                a3.init(4, 2);
                a4.init(4, 3);
                a1.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a1.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a1.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a1.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                a2.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a2.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a2.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a2.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                a3.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a3.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a3.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a3.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                a4.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a4.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a4.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a4.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                t1.setOther(0, a2);
                t1.setOther(1, a3);
                t1.setOther(2, a4);
                t2.setOther(0, a1);
                t2.setOther(1, a3);
                t2.setOther(2, a4);
                t3.setOther(0, a1);
                t3.setOther(1, a2);
                t3.setOther(2, a4);
                t4.setOther(0, a1);
                t4.setOther(1, a2);
                t4.setOther(2, a3);
                if (Globals.myPlayerId == 0)
                {
                    a1.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a1), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 1)
                {
                    a2.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a2), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 2)
                {
                    a3.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a3), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 3)
                {
                    a4.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a4), "ReceivingActor");
                }
                a1.addMoveListener(t1);
                a2.addMoveListener(t2);
                a3.addMoveListener(t3);
                a4.addMoveListener(t4);
                a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a3.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a4.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a1.start();
                a2.start();
                a3.start();
                a4.start();
            }

            Application.Run();
        }
Ejemplo n.º 5
0
        public static bool startgame()
        {
            int    gamesize = 0;
            string temp     = "";

            Console.WriteLine("To cancel the registration enter 'delete'");
            Console.WriteLine("Please choose game Size max Size 4:");
            temp = Console.ReadLine();
            try
            {
                int.TryParse(temp, out gamesize);
                while (String.IsNullOrEmpty(temp) || gamesize == 0 || gamesize > 4 || gamesize < 2)
                {
                    Console.WriteLine("GameSize cannot be empty or non Number. Please choose a player name:");
                    temp = Console.ReadLine();

                    int.TryParse(temp, out gamesize);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Please choose game Size:");
            }
            Console.WriteLine("Please choose a player name:");
            playerName = Console.ReadLine();

            while (playerName == "")
            {
                Console.WriteLine("Your name cannot be empty. Please choose a player name:");
                playerName = Console.ReadLine();
            }
            try
            {
                //startActorSystem("alcatraz");
                string unique = DateTime.Now.ToString().Replace("\\", "").Replace("/", "").Replace(":", "").Replace(" ", "");
                // Setup an actor that will handle deadletter type messages
                var deadletterWatchMonitorProps = Props.Create(() => new DeadletterMonitor());

                var deadletterWatchActorRef = Globals.ActSys.ActorOf(deadletterWatchMonitorProps, "DeadLetterMonitoringActor" + unique);

                // subscribe to the event stream for messages of type "DeadLetter"
                Globals.ActSys.EventStream.Subscribe(deadletterWatchActorRef, typeof(DeadLetter));

                var localChatActor = Globals.ActSys.ActorOf(Props.Create <RegisterActor>(), "RegisterActor" + unique);

                string remoteActorAddressClient1 = "akka.tcp://[email protected]:5555/user/RegisterActor";
                var    remoteChatActorClient1    = Globals.ActSys.ActorSelection(remoteActorAddressClient1);
                try
                {
                    if (remoteChatActorClient1 != null)
                    {
                        remoteChatActorClient1.Tell("register" + playerName + "|" + gamesize, localChatActor);


                        while (line != "gamestart")
                        {
                            if (line == "delete")
                            {
                                remoteChatActorClient1.Tell("delete|" + playerName, localChatActor);
                                line = string.Empty;
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Could not get remote actor ref");
                        Console.ReadLine();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(false);
            }

            //ANBINDUNG ZUM SERRVER - end

            Globals.myName = playerName;

            /*
             * string testJSON = @"[
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5248,""actorName"":""ReceivingActor"",""playerId"":0,""playerName"":""Franz""},
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5249,""actorName"":""ReceivingActor"",""playerId"":1,""playerName"":""Bashar""}
             * ]";
             *
             *
             * string testJSON3 = @"[
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5248,""actorName"":""ReceivingActor"",""playerId"":0,""playerName"":""Franz""},
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5249,""actorName"":""ReceivingActor"",""playerId"":1,""playerName"":""Bashar""},
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5250,""actorName"":""ReceivingActor"",""playerId"":2,""playerName"":""Indrit""}
             * ]";
             *
             * string testJSON4 = @"[
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5248,""actorName"":""ReceivingActor"",""playerId"":0,""playerName"":""Franz""},
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5249,""actorName"":""ReceivingActor"",""playerId"":1,""playerName"":""Bashar""},
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5250,""actorName"":""ReceivingActor"",""playerId"":2,""playerName"":""Indrit""},
             *  {""protocol"":""akka.tcp"",""system"":""alcatraz"",""host"":""localhost"",""port"":5251,""actorName"":""ReceivingActor"",""playerId"":3,""playerName"":""Palo""}
             * ]";
             */

            //Console.WriteLine(Globals.remoteActorAddresses.ElementAt(0));

            foreach (var item in Globals.AllPlayers)
            {
                //Console.WriteLine(item.ToString());

                //Globals.remoteActorAddresses.Add(item.ToString());

                if (item.playerName == Globals.myName)
                {
                    Globals.myPlayerId = item.playerId;
                    //break;
                }
                else
                {
                    //Console.WriteLine(item.ToString());
                    Globals.remoteActorAddresses.Add(item.ToString());
                }
            }

            if (Globals.AllPlayers.Count == 2)
            {
                Game     t1 = new Game();
                Game     t2 = new Game();
                Alcatraz a1 = new Alcatraz();
                Alcatraz a2 = new Alcatraz();
                t1.setNumPlayer(Globals.AllPlayers.Count);
                t2.setNumPlayer(Globals.AllPlayers.Count);
                a1.init(2, 0);
                a2.init(2, 1);
                a1.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a1.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a2.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a2.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                t1.setOther(0, a2);
                t2.setOther(0, a1);
                if (Globals.myPlayerId == 0)
                {
                    a1.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a1), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 1)
                {
                    a2.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a2), "ReceivingActor");
                }
                a1.addMoveListener(t1);
                a2.addMoveListener(t2);
                a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a1.start();
                a2.start();
            }
            else if (Globals.AllPlayers.Count == 3)
            {
                Game     t1 = new Game();
                Game     t2 = new Game();
                Game     t3 = new Game();
                Alcatraz a1 = new Alcatraz();
                Alcatraz a2 = new Alcatraz();
                Alcatraz a3 = new Alcatraz();
                t1.setNumPlayer(Globals.AllPlayers.Count);
                t2.setNumPlayer(Globals.AllPlayers.Count);
                t3.setNumPlayer(Globals.AllPlayers.Count);
                a1.init(3, 0);
                a2.init(3, 1);
                a3.init(3, 2);
                a1.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a1.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a1.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a2.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a2.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a2.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a3.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a3.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a3.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                t1.setOther(0, a2);
                t1.setOther(1, a3);
                t2.setOther(0, a1);
                t2.setOther(1, a3);
                t3.setOther(0, a1);
                t3.setOther(1, a2);
                if (Globals.myPlayerId == 0)
                {
                    a1.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a1), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 1)
                {
                    a2.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a2), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 2)
                {
                    a3.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a3), "ReceivingActor");
                }
                a1.addMoveListener(t1);
                a2.addMoveListener(t2);
                a3.addMoveListener(t3);
                a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a3.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a1.start();
                a2.start();
                a3.start();
            }
            else if (Globals.AllPlayers.Count == 4)
            {
                Game     t1 = new Game();
                Game     t2 = new Game();
                Game     t3 = new Game();
                Game     t4 = new Game();
                Alcatraz a1 = new Alcatraz();
                Alcatraz a2 = new Alcatraz();
                Alcatraz a3 = new Alcatraz();
                Alcatraz a4 = new Alcatraz();
                t1.setNumPlayer(Globals.AllPlayers.Count);
                t2.setNumPlayer(Globals.AllPlayers.Count);
                t3.setNumPlayer(Globals.AllPlayers.Count);
                t4.setNumPlayer(Globals.AllPlayers.Count);
                a1.init(4, 0);
                a2.init(4, 1);
                a3.init(4, 2);
                a4.init(4, 3);
                a1.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a1.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a1.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a1.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                a2.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a2.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a2.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a2.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                a3.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a3.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a3.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a3.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                a4.getPlayer(0).Name = Globals.AllPlayers.ElementAt(0).playerName;
                a4.getPlayer(1).Name = Globals.AllPlayers.ElementAt(1).playerName;
                a4.getPlayer(2).Name = Globals.AllPlayers.ElementAt(2).playerName;
                a4.getPlayer(3).Name = Globals.AllPlayers.ElementAt(3).playerName;
                t1.setOther(0, a2);
                t1.setOther(1, a3);
                t1.setOther(2, a4);
                t2.setOther(0, a1);
                t2.setOther(1, a3);
                t2.setOther(2, a4);
                t3.setOther(0, a1);
                t3.setOther(1, a2);
                t3.setOther(2, a4);
                t4.setOther(0, a1);
                t4.setOther(1, a2);
                t4.setOther(2, a3);
                if (Globals.myPlayerId == 0)
                {
                    a1.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a1), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 1)
                {
                    a2.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a2), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 2)
                {
                    a3.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a3), "ReceivingActor");
                }
                else if (Globals.myPlayerId == 3)
                {
                    a4.showWindow();
                    var localReceivingActor = Globals.ActSys.ActorOf(Props.Create <ReceivingActor>(a4), "ReceivingActor");
                }
                a1.addMoveListener(t1);
                a2.addMoveListener(t2);
                a3.addMoveListener(t3);
                a4.addMoveListener(t4);
                a1.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a2.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a3.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a4.getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                a1.start();
                a2.start();
                a3.start();
                a4.start();
            }

            Application.Run();
            return(true);
        }