예제 #1
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();
        }
예제 #2
0
        public Client initializeClient(int playerID, int numberOfPlayer, ClientData[] data, string uniqueName)
        {
            //Game logic
            clientAlcatraz.init(numberOfPlayer, playerID);

            for (int j = 1; j < numberOfPlayer + 1; j++)
            {
                int help = j - 1;
                clientAlcatraz.getPlayer(help).Name = "Player " + j;
            }
            Client client = new Client(clientAlcatraz, playerID);

            for (int jj = 0; jj < numberOfPlayer - 1; jj++)
            {
                Console.WriteLine("Tell Client" + jj);
                //System.Threading.Thread.Sleep(5000);
                Console.WriteLine("send to: " + remoteChatActorClient[jj].Path);
                Console.WriteLine("send to: " + remoteChatActorClient[jj].PathString);
                //remoteActor.Tell(client, sender);
                //string line = "";
                //while (line != null && line != "received")
                //{
                //    line = Console.ReadLine();
                //    remoteActor.Tell(client, sender);
                //}
                //            remoteChatActorClient[jj].Tell(client, child);
            }
            playerNumber = numberOfPlayer;
            return(client);
        }
예제 #3
0
        public Client initializeClient(int playerID, int numberOfPlayer)
        {
            ClientClass clientClass    = new ClientClass(numberOfPlayer);
            Alcatraz    clientAlcatraz = new Alcatraz();

            clientClass.setNumPlayer(numPlayer);
            clientAlcatraz.init(numPlayer, playerID);

            for (int j = 1; j < numPlayer + 1; j++)
            {
                int help = j - 1;
                clientAlcatraz.getPlayer(help).Name = "Player " + j;
            }
            return(new Client(clientClass, clientAlcatraz, playerID));
        }
예제 #4
0
        public Client initializeClient(int playerID, int numberOfPlayer)
        {
            //Game logic
            clientAlcatraz.init(numberOfPlayer, playerID);

            for (int j = 1; j < numberOfPlayer + 1; j++)
            {
                int help = j - 1;
                clientAlcatraz.getPlayer(help).Name = "Player " + j;
            }
            Client client = new Client(clientAlcatraz, playerID);

            for (int jj = 0; jj < numberOfPlayer; jj++)
            {
                Console.WriteLine("Tell Client" + jj);
                //remoteChatActorClient[jj].Tell(client, child);
            }
            playerNumber = numberOfPlayer;
            return(client);
        }
예제 #5
0
            protected override void OnReceive(object message)
            {
                Move receivedMove = JsonConvert.DeserializeObject <Move>(message.ToString());

                myGame.doMove(myGame.getPlayer(receivedMove.playerId), myGame.getPrisoner(receivedMove.prisonerId), receivedMove.rowOrCol, receivedMove.row, receivedMove.col);
            }
예제 #6
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();
        }
예제 #7
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);
        }