Exemplo n.º 1
0
        private void RandomDiceRoll(Player player)
        {
            var diceDict = DiceValues.Dice;

            player.DiceRolled = new Tuple <string, int> [3][];
            Random random     = new Random();
            var    pokerRules = new PokerRules();

            for (int i = 1; i <= 3; i++)
            {
                var handArray = new Tuple <string, int> [5];
                Console.WriteLine($"{player.Name} press enter to take dice roll number {i}");
                Console.ReadLine();

                for (int j = 0; j <= 4; j++)
                {
                    var randomDice = diceDict.ElementAt(random.Next(0, diceDict.Count)).Key;
                    handArray[j] = Tuple.Create(randomDice, diceDict[randomDice]);
                }

                player.DiceRolled[i - 1] = handArray.OrderBy(x => x.Item2).ToArray();

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine($"{player.Name} rolled {player.DiceRolled[i - 1][0].Item1}, " +
                                  $"{player.DiceRolled[i - 1][1].Item1}, " +
                                  $"{player.DiceRolled[i - 1][2].Item1}, " +
                                  $"{player.DiceRolled[i - 1][3].Item1}, " +
                                  $"{player.DiceRolled[i - 1][4].Item1}");
                Console.ResetColor();
                pokerRules.FindMatchingDice(player.DiceRolled[i - 1]);
            }

            Console.WriteLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var p            = new Program();
            var b            = new PokerRules();
            int numOfPlayers = p.ObtainNumOfPlayers();

            Player[] players = p.CreatePlayers(numOfPlayers);
            p.RollDice(players);

            Console.ReadLine();
        }