Example #1
0
        static public CreatePlayer[,] CreatePlayers()
        {
            // creating  2 players on each position.
            // player1 player2 on the 1st Position


            CreatePlayer player1, player2, player11, player12;

            player1           = new CreatePlayer("Tooba", 2, 1); // players name, VORP , Cost
            player2           = new CreatePlayer("Wasia", 3, 1);
            player11          = new CreatePlayer("Naymat", 3, 1);
            player12          = new CreatePlayer("Rutabah", 4, 1);
            CreatePlayer[,] p = { { null, null, null }, { null, player1, player2 }, { null, player11, player12 } }; //
            return(p);
        }
Example #2
0
        static public void TotalCost(CreatePlayer[,] p, int N, int P)
        {
            p_ = new CreatePlayer[N + 1, P + 1]; //  new Helper table created

            for (int i = 1; i < p.GetLength(1); i++)
            {
                int sum = 0;
                int max = Int32.MinValue;
                for (int j = 1; j < p.GetLength(0); j++)
                {
                    p_[i, j]      = new CreatePlayer();
                    p_[i, j].name = p[i, j].name;
                    sum           = sum + p[i, j].cost;
                    if (p[i, j].VORP > max)
                    {
                        max           = p[i, j].VORP;
                        p_[i, j].VORP = max; //  at "0 to i" position-max VORP
                    }
                    p_[i, j].cost = sum;     //  "0 to i" position-total cost
                }
            }
        }