Ejemplo n.º 1
0
        public PlayPiece[] createLudoPieces()
        {
            PlayPiece[] pPiece = new PlayPiece[16];

            //Point[] startPoint = { new Point(1, 4), new Point(2, 4), new Point(1, 5), new Point(2, 5), new Point(9, 1), new Point(9, 2), new Point(10, 1), new Point(10, 2), new Point(12, 9), new Point(13, 9), new Point(12, 10), new Point(13, 10), new Point(4, 12), new Point(5, 12), new Point(4, 13), new Point(5, 13) };
            string[] state = new string[3];

            for (int i = 0; i <= pPiece.Length; i++)
            {
                if (i < 4)
                {
                    pPiece[i] = new PlayPiece(LudoHelper.color.green, 1, LudoHelper.state.ude, false, "g" + (i + 1));
                }
                else if (i > 3 && i < 8)
                {
                    pPiece[i] = new PlayPiece(LudoHelper.color.blue, 14, LudoHelper.state.ude, false, "b" + (i - 3));
                }
                else if (i > 7 && i < 12)
                {
                    pPiece[i] = new PlayPiece(LudoHelper.color.yellow, 27, LudoHelper.state.ude, false, "y" + (i - 7));
                }
                else if (i > 11 && i < 16)
                {
                    pPiece[i] = new PlayPiece(LudoHelper.color.red, 40, LudoHelper.state.ude, false, "r" + (i - 11));
                }
            }

            return(pPiece);
        }
Ejemplo n.º 2
0
        public void startgame(int antalSP)
        {
            Random  rand = new Random();
            Control ctrl = new Control();

            LudoBoardField[] ludoBoard = new LudoBoardField[52];
            PlayPiece[]      pieces    = new PlayPiece[16];
            player    = new Player[antalSP];
            ludoBoard = this.ludoBoard.makeBoard();


            pieces = this.ludoBoard.createLudoPieces();
            LudoHelper.color[] ludoHelp = new LudoHelper.color[4];
            ludoHelp[0] = LudoHelper.color.red;
            ludoHelp[1] = LudoHelper.color.yellow;
            ludoHelp[2] = LudoHelper.color.blue;
            ludoHelp[3] = LudoHelper.color.green;
            Dice ludoDice = new Dice(6);

            int[] rNumber = ludoDice.getRandomNR(0, antalSP);

            ludoHelp = ctrl.unsortArray(ludoHelp);

            int tal = 0;

            for (int i = 0; i <= antalSP - 1; i++)
            {
                tal       = rNumber[i];
                player[i] = new Player(false, ludoHelp[tal], true, tal + 1);
            }

            player = ctrl.sortArray(player);

            for (int i = 0; i < player.Length; i++)
            {
                Console.WriteLine("Spiller nr {0:D} har fået farve {1:D}", player[i].playerNr, player[i].colorChoise.ToString());
            }
            tal = rand.Next(0, 4);
            //Console.WriteLine("Det er spiller nr {0:D} der starter med {1:D} farve", tal+1, player[tal].colorChoise.ToString());

            moveOutNOn(player[tal].colorChoise, pieces);
        }