/*This is the starting point of the function*/
main()
{
   var NDecks;
   var Dealer;
   var numplayers;
   var CName;
   var dealer;
   var player1;
   var player2;
   var player3;
   var i;
   var pvalue;
   var dvalue;
   var anothercard;
   var bust;
   NDecks = 1; 
   Dealer = true;
   
   CName = "HighCard";
   /*Print out what card game*/
   Print("You are playing");
   Print(CName);
   
   Print("How many players are playing?  Enter a number between 1 and 3");
   Read(numplayers);
   while(numplayers < 1 || numplayers > 3)
   {
      Print("Wrong number of players! How many players are playing?  Enter a number between 1 and 5.");
      Read(numplayers);
   }

   /*Shuffle(Deck); Shuffle isn't implemented yet */
   
   Deal(dealer); /*This will take the top card from the deck and add it to the dealers hand.*/
   Print("The dealer's card is");
   Print(dealer);

   Deal(player1);
   Print("Players one's card is:");
   Print(player1);

   if(numplayers > 1)
   {
      Deal(player2);
       Print("Players two's card is:");
      Print(player2);   
   }
   if(numplayers > 2)
   {
      Deal(player3);
      Print("Players three's card is:");
      Print(player3);
   }
      
   if(dealer > player1)
   {
      if(dealer > player2)
      {
         if(dealer > 3)
         {
           Print("Dealer wins");
         }
         else
         {
           Print("Player 3 wins");
         }
      }
      else 
      {   
         if(player2 > player3)
         {
            Print("Player 2 wins");
         }
         else
         {
            Print("Player 3 wins");
         }

      } 
    }
    else
    {
      if(player1 > player2)
      {
         if(player1 > player3)
         {
            Print("Player1 wins");
         }    
      }
      else
      {
         if(player2 > player3)
         {
            Print("Player2 wins");
         }
         else
         {
           Print("Player3 wins");
         }  
      }
    }     
}

 