/// <summary> /// Runs a whole match against the computer. /// </summary> public void RunProgramWithAI() { UserInterface ui = new UserInterface(); Console.Clear(); CardHandler cardHandler = new CardHandler(); CSVHandler csvHandler = new CSVHandler(); csvHandler.CsvHandler("Cards.csv"); cardHandler.deck = csvHandler.listOfCards; string playerName = ui.AskPlayerName("Player 1"); Player player1 = new Player(playerName, cardHandler.FirstHandDealer()); //Sets player1's wonBefore to true , so he will start the first round player1.wonBefore = true; AI ai = new AI(cardHandler.FirstHandDealer()); ui.DealingCardsPrint(); int Index = 0; while (player1.hand.Count > 0 && ai.hand.Count > 0) { SimulateRoundWithAI(player1, ai, cardHandler); Index++; } ui.PrintGameWinner(GetWinner(player1, ai)); }
/// <summary> /// Runs a whole match between to players. /// </summary> public void RunProgramWith1v1() { UserInterface ui = new UserInterface(); Console.Clear(); CardHandler cardHandler = new CardHandler(); CSVHandler csvHandler = new CSVHandler(); csvHandler.CsvHandler("Cards.csv"); //Puts the cards read out from the csv to the deck cardHandler.deck = csvHandler.listOfCards; string playerName = ui.AskPlayerName("Player 1"); Player player1 = new Player(playerName, cardHandler.FirstHandDealer()); player1.wonBefore = true; string player2Name = ui.AskPlayerName("Player 2"); Player player2 = new Player(player2Name, cardHandler.FirstHandDealer()); ui.DealingCardsPrint(); int Index = 0; while (player1.hand.Count > 0 && player2.hand.Count > 0) { SimulateRound(player1, player2, cardHandler); Index++; } ui.PrintGameWinner(GetWinner(player1, player2)); }