public void DisplayDraw(Baccarat game) // displays outcome of draw phase of game { if (game.PHand.Size == 2) { Console.WriteLine("The player has stood"); Console.ReadLine(); } if (game.PHand.Size == 3) { Console.WriteLine("The player has drawn the " + game.PHand[2].getCardText()); Console.ReadLine(); } if (game.BHand.Size == 2) { Console.WriteLine("The banker has stood"); Console.ReadLine(); } if (game.BHand.Size == 3) { Console.WriteLine("The banker has drawn the " + game.BHand[2].getCardText()); Console.ReadLine(); } Console.WriteLine(); }
static void Main(string[] args) { //create loop for game and set up the game bool exit = false; BaccaratGameDisplaying gameUI = new BaccaratGameDisplaying(); Baccarat game = new Baccarat(); while (exit == false) { //get the bet and start the game game.MakeBet(); game.DealGame(); gameUI.DisplayInLine(game); Console.ReadLine(); //check for natural win if (game.NaturalWin()) { Console.WriteLine("One player has a Natural: the game is over"); } else { //if not, check and draw cards game.DrawCard(); gameUI.DisplayDraw(game); gameUI.DisplayInLine(game); } //display the result of the game Console.ReadLine(); char winChar = gameUI.FinalResult(game); Console.ReadLine(); //sort out the bets if (game.BetLocation == winChar) { game.ResolveTurn(true); } else { game.ResolveTurn(false); } //display the money Console.WriteLine("Money at the moment is {0}", game.Money); //logic for second + round Console.Write("Enter Y for another round--> "); string choice = Console.ReadLine(); if (choice != "Y") { exit = true; } } //end of game Console.WriteLine("Money at the end of the game is {0}", game.Money); }
public void FinalResult(Baccarat game) // displays outcome of game { if (game.PScore > game.BScore) { Console.WriteLine("The Player has won"); } if (game.BScore > game.PScore) { Console.WriteLine("The Banker has won"); } if (game.PScore == game.BScore) { Console.WriteLine("It's a tie"); } }
static void Main(string[] args) { BaccaratGameUI gameUI = new BaccaratGameUI(); Baccarat game = new Baccarat(); game.Deal(); gameUI.Display(game); if (game.Natural()) { Console.WriteLine("One player has a Natural: the game is over"); } else { game.Draw(); gameUI.DisplayDraw(game); gameUI.Display(game); } gameUI.FinalResult(game); Console.ReadLine(); }
public void Display(Baccarat game) // displays players' hands and scores { Console.WriteLine("Player's cards: "); for (int i = 0; i < game.PHand.Size; i++) { Console.WriteLine(game.PHand[i].GetRankAsString() + " of " + game.PHand[i].GetSuitAsString()); } Console.WriteLine(); Console.WriteLine("Banker's cards: "); for (int i = 0; i < game.BHand.Size; i++) { Console.WriteLine(game.BHand[i].GetRankAsString() + " of " + game.BHand[i].GetSuitAsString()); } Console.WriteLine(); Console.WriteLine("Player's score: " + game.PScore); Console.WriteLine("Banker's score: " + game.BScore); Console.WriteLine(); }
public char FinalResult(Baccarat game) // displays outcome of game { char winChar = ' '; if (game.PScore > game.BScore) { Console.WriteLine("The Player has won"); winChar = 'P'; } if (game.BScore > game.PScore) { Console.WriteLine("The Banker has won"); winChar = 'B'; } if (game.PScore == game.BScore) { Console.WriteLine("It's a tie"); winChar = 'T'; } return(winChar); }
public void DisplayDraw(Baccarat game) // displays outcome of draw phase of game { if (game.PHand.Size == 2) { Console.WriteLine("The player has stood"); } if (game.PHand.Size == 3) { Console.WriteLine("The player has drawn the " + game.PHand[2].GetRankAsString() + " of " + game.PHand[2].GetSuitAsString()); } if (game.BHand.Size == 2) { Console.WriteLine("The banker has stood"); } if (game.BHand.Size == 3) { Console.WriteLine("The banker has drawn the " + game.BHand[2].GetRankAsString() + " of " + game.BHand[2].GetSuitAsString()); } Console.WriteLine(); }
//class for the UI of the game public void DisplayInLine(Baccarat game) { //displays players and bankers hand Console.WriteLine("Player's cards are: "); if (game.PHand.Size == 2) { game.PHand.display2CardASCII(game.PHand); } else { game.PHand.display3CardASCII(game.PHand); } Console.WriteLine("Banker's cards: "); if (game.BHand.Size == 2) { game.BHand.display2CardASCII(game.PHand); } else { game.BHand.display3CardASCII(game.BHand); } Console.WriteLine("Player's score: " + game.PScore); Console.WriteLine("Banker's score: " + game.BScore + "\n"); }