/* Group of name : Dream Figher J
          Name of the group: Giyeon Kim, Jing Li

            Add extra feature: Change the suit to symbols and made the cards looks like
            classing game feature (like make a box so it looks like a card)
            and change the color of the text of the computer and player cards hand so
            it easily to see the different of both players
        */
        static void Main(string[] args)
        {
            bool exit = false;
            Players player = new Players(); // first players
            Players computer = new Players(); // computer
            Console.ForegroundColor = ConsoleColor.White; // change the color of the first player

            player.GenerateHand(); // calls the card of hand method of first player
            computer.GenerateHand(); // calls the card of the hand method for computer
            // the introduction
            Console.WriteLine("Welcome to poker game!");
            Console.WriteLine("\nReady to play? (y/n)");
            string userinput = Console.ReadLine();
            if (userinput == "N" || userinput == "n")
                exit = true;
            // putting the face and suit in different arrays
            string[] x = new string[5];
            string[] su = new string[5];
            string[] group = new string[5];
            // ranking the player and computer
            int player_rank = 0;
            int computer_rank = 0;
            // putting in a loop so it doesnt exit
            while (!exit)
            {
                Console.WriteLine("\nYour cards are:\n");
                for (int i = 0; i < 5; i++)
                {

                    // putting face in one array and putting suit in another array and also put together in one array
                    x[i] = player.hand[i].Face.ToString();
                    su[i] = player.hand[i].Suits.ToString();
                    group[i] = player.hand[i].Face.ToString() + " of " + player.hand[i].Suits.ToString();
                }
                //sort them first
                Array.Sort(x);
                Array.Sort(su);
                Array.Sort(group);

                // rank them
                player_rank = num(x, su);
                // putting them in descending order so number first them letters
                organize(player_rank, x, su, group);
                Console.WriteLine("The rank of player is " + player_rank);
                // put into rank name
                HandRank(player_rank);
                // putting them in colors
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\nComputer Cards are: \n");
                Console.ForegroundColor = ConsoleColor.White;

                // this is computer. so creating 3 arrays for it
                string[] d = new string[5];
                string[] y = new string[5];
                string[] su1 = new string[5];
                for (int j = 0; j < 5; j++)
                {
                    // add face to one array. add suit to another array. then add both to another array
                    y[j] = computer.hand[j].Face.ToString();
                    su1[j] = computer.hand[j].Suits.ToString();
                    d[j] = (computer.hand[j].Face.ToString()+" of "+ computer.hand[j].Suits.ToString()) ;
                }
                // sort them first
                Array.Sort(d);
                Array.Sort(y);
                Array.Sort(su1);
                // rank the computer
                computer_rank = num(y, su1);
                // print them out in order
                organize(computer_rank, y, su1, d);
                // put into rank name
                HandRank(computer_rank);
                Console.WriteLine("The computer rank is " + computer_rank);
                // tell which one wins
                if (player_rank < computer_rank)
                    Console.WriteLine("player wins");
                if (player_rank > computer_rank)
                    Console.WriteLine("computer wins");
                if (player_rank == computer_rank)
                    Console.WriteLine("They are tie");

                // exit the loop
                exit = true;
            }

            Console.WriteLine("\nThank you for Playing the Game! \nPress any key to exit the game!");

            Console.ReadKey();
        }
 // determine the winner of the players
 public Players DetermineWinner(Players One, Players Two)
 {
     return null;
 }
        static void Main(string[] args)
        {
            bool exit = false;
            Players player = new Players();
            Players computer = new Players();
            Console.ForegroundColor = ConsoleColor.White;

            player.GenerateHand();
            computer.GenerateHand();
            Console.WriteLine("Welcome to poker game!");
            Console.WriteLine("\nReady to play? (y/n)");
            string userinput = Console.ReadLine();
            if (userinput == "N" || userinput == "n")
                exit = true;
            string[] x = new string[5];
            string[] su = new string[5];
            string[] group = new string[5];
            int player_rank = 0;
            int computer_rank = 0;
            while (!exit)
            {
                Console.WriteLine("\nYour cards are:\n");
                for (int i = 0; i < 5; i++)
                {

                    x[i] = player.hand[i].Face.ToString();
                    su[i] = computer.hand[i].Suits.ToString();
                    group[i] = player.hand[i].Face.ToString() + " of " + computer.hand[i].Suits.ToString();
                }
                Array.Sort(x);
                Array.Sort(su);
                Array.Sort(group);

                player_rank = num(x, su);
                organize(player_rank, x, su, group);
                Console.WriteLine("The rank of player is " + player_rank);

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\nComputer Cards are: \n");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine( " is the number of pair player got");
                string[] d = new string[5];
                string[] y = new string[5];
                string[] su1 = new string[5];

                for (int j = 0; j < 5; j++)
                {
                    y[j] = computer.hand[j].Face.ToString();
                    su1[j] = computer.hand[j].Suits.ToString();
                    d[j] = (computer.hand[j].Face.ToString()+" of "+ computer.hand[j].Suits.ToString()) ;
                }
                Array.Sort(d);
                Array.Sort(y);
                Array.Sort(su1);
                computer_rank = num(y, su1);
                organize(computer_rank, y, su1, d);
                Console.WriteLine("The computer rank is " + computer_rank);

                if (player_rank < computer_rank)
                    Console.WriteLine("player wins");
                if (player_rank > computer_rank)
                    Console.WriteLine("computer wins");
                if (player_rank == computer_rank)
                    Console.WriteLine("They are tie");

                exit = true;
            }

            Console.WriteLine("\nThank you for Playing the Game! \nPress any key to exit the game!");

            Console.ReadKey();
        }