Example #1
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);
        }
Example #2
0
        //Board i et Array
        public LudoBoardField[] makeBoard()
        {
            LudoBoardField[] lb = new LudoBoardField[52];

            for (int i = 0; i <= lb.Length; i++)
            {
                switch (i)
                {
                case 0:
                    lb[i] = new LudoBoardField(new Point(0, 6), LudoHelper.type.normal);
                    break;

                case 1:
                    lb[i] = new LudoBoardField(new Point(1, 6), LudoHelper.type.greenstart);
                    break;

                case 2:
                    lb[i] = new LudoBoardField(new Point(2, 6), LudoHelper.type.normal);
                    break;

                case 3:
                    new LudoBoardField(new Point(3, 6), LudoHelper.type.normal);
                    break;

                case 4:
                    new LudoBoardField(new Point(4, 6), LudoHelper.type.normal);
                    break;

                case 5:
                    new LudoBoardField(new Point(5, 6), LudoHelper.type.normal);
                    break;

                case 6:
                    new LudoBoardField(new Point(6, 5), LudoHelper.type.star);
                    break;

                case 7:
                    new LudoBoardField(new Point(6, 4), LudoHelper.type.normal);
                    break;

                case 8:
                    new LudoBoardField(new Point(6, 3), LudoHelper.type.normal);
                    break;

                case 9:
                    new LudoBoardField(new Point(6, 2), LudoHelper.type.globe);
                    break;

                case 10:
                    new LudoBoardField(new Point(6, 1), LudoHelper.type.normal);
                    break;

                case 11:
                    new LudoBoardField(new Point(6, 0), LudoHelper.type.normal);
                    break;

                case 12:
                    lb[i] = new LudoBoardField(new Point(7, 0), LudoHelper.type.bluegoal);
                    break;

                case 13:
                    new LudoBoardField(new Point(8, 0), LudoHelper.type.normal);
                    break;

                case 14:
                    lb[i] = new LudoBoardField(new Point(8, 1), LudoHelper.type.bluestart);
                    break;

                case 15:
                    new LudoBoardField(new Point(8, 2), LudoHelper.type.normal);
                    break;

                case 16:
                    new LudoBoardField(new Point(8, 3), LudoHelper.type.normal);
                    break;

                case 17:
                    new LudoBoardField(new Point(8, 4), LudoHelper.type.normal);
                    break;

                case 18:
                    new LudoBoardField(new Point(8, 5), LudoHelper.type.normal);
                    break;

                case 19:
                    new LudoBoardField(new Point(9, 6), LudoHelper.type.star);
                    break;

                case 20:
                    new LudoBoardField(new Point(10, 6), LudoHelper.type.normal);
                    break;

                case 21:
                    new LudoBoardField(new Point(11, 6), LudoHelper.type.normal);
                    break;

                case 22:
                    new LudoBoardField(new Point(12, 6), LudoHelper.type.globe);
                    break;

                case 23:
                    new LudoBoardField(new Point(13, 6), LudoHelper.type.normal);
                    break;

                case 24:
                    new LudoBoardField(new Point(14, 6), LudoHelper.type.normal);
                    break;

                case 25:
                    lb[i] = new LudoBoardField(new Point(14, 7), LudoHelper.type.yellowgoal);
                    break;

                case 26:
                    new LudoBoardField(new Point(14, 8), LudoHelper.type.normal);
                    break;

                case 27:
                    lb[i] = new LudoBoardField(new Point(13, 8), LudoHelper.type.yellowstart);
                    break;

                case 28:
                    new LudoBoardField(new Point(12, 8), LudoHelper.type.normal);
                    break;

                case 29:
                    new LudoBoardField(new Point(11, 8), LudoHelper.type.normal);
                    break;

                case 30:
                    new LudoBoardField(new Point(10, 8), LudoHelper.type.normal);
                    break;

                case 31:
                    new LudoBoardField(new Point(9, 8), LudoHelper.type.normal);
                    break;

                case 32:
                    new LudoBoardField(new Point(8, 9), LudoHelper.type.star);
                    break;

                case 33:
                    new LudoBoardField(new Point(8, 10), LudoHelper.type.normal);
                    break;

                case 34:
                    new LudoBoardField(new Point(8, 11), LudoHelper.type.normal);
                    break;

                case 35:
                    new LudoBoardField(new Point(8, 12), LudoHelper.type.globe);
                    break;

                case 36:
                    new LudoBoardField(new Point(8, 13), LudoHelper.type.normal);
                    break;

                case 37:
                    new LudoBoardField(new Point(8, 14), LudoHelper.type.normal);
                    break;

                case 38:
                    lb[i] = new LudoBoardField(new Point(7, 14), LudoHelper.type.redgoal);
                    break;

                case 39:
                    new LudoBoardField(new Point(7, 8), LudoHelper.type.normal);
                    break;

                case 40:
                    lb[i] = new LudoBoardField(new Point(6, 13), LudoHelper.type.redstart);
                    break;

                case 41:
                    new LudoBoardField(new Point(6, 12), LudoHelper.type.normal);
                    break;

                case 42:
                    new LudoBoardField(new Point(6, 11), LudoHelper.type.normal);
                    break;

                case 43:
                    new LudoBoardField(new Point(6, 10), LudoHelper.type.normal);
                    break;

                case 44:
                    new LudoBoardField(new Point(6, 9), LudoHelper.type.normal);
                    break;

                case 45:
                    new LudoBoardField(new Point(5, 8), LudoHelper.type.star);
                    break;

                case 46:
                    new LudoBoardField(new Point(4, 8), LudoHelper.type.normal);
                    break;

                case 47:
                    new LudoBoardField(new Point(3, 8), LudoHelper.type.normal);
                    break;

                case 48:
                    new LudoBoardField(new Point(2, 8), LudoHelper.type.globe);
                    break;

                case 49:
                    new LudoBoardField(new Point(1, 8), LudoHelper.type.normal);
                    break;

                case 50:
                    new LudoBoardField(new Point(0, 8), LudoHelper.type.normal);
                    break;

                case 51:
                    lb[i] = new LudoBoardField(new Point(0, 7), LudoHelper.type.greengoal);
                    break;
                }
            }

            return(lb);
        }