using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Net.Configuration; using System.Runtime.InteropServices; using System.Security.Policy; using System.Text; using System.Threading.Tasks; namespace InvestingGame_v0._4 { public class Cards { public string[,] cards = { { "Ace", "Deuce", "Trey", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" }, //hearts { "Ace", "Deuce", "Trey", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" }, //diamonds { "Ace", "Deuce", "Trey", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" }, //clubs { "Ace", "Deuce", "Trey", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" } //spade }; } class gameChoice { public static void Main() { Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Choose a minigame:"); Console.WriteLine("(1) - Coin Flip"); Console.WriteLine("(2) - BlackJack"); Console.WriteLine("(3) - Exit"); Console.WriteLine(); int choice = Convert.ToInt32(Console.ReadLine()); switch (choice) { case 1: coinFlip coinFlip = new coinFlip(); coinFlip.Flip(); break; case 2: blackJack blackJack = new blackJack(); blackJack.Play(); break; case 3: break; default: break; } } } public class Betting { public static int money = 100; public static int bet; public static void placeBet() { bet = 0; Console.WriteLine("Balance: " + money + "$"); Console.WriteLine("(1) - Bet 5$"); Console.WriteLine("(2) - Bet 10$"); Console.WriteLine("(3) - Bet 20$"); Console.WriteLine("(4) - ALL IN $$$"); Console.WriteLine("(5) - Bet chosen amount $"); Console.WriteLine("(6) - Back"); Console.WriteLine(); int choice = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); switch (choice) { case 1: money = money - 5; bet = bet + 5; Console.Clear(); Console.WriteLine("Balance: " + money + "$"); Console.WriteLine(); Console.WriteLine("Bet: " + bet + "$"); Console.WriteLine(); break; case 2: money = money - 10; bet = bet + 10; Console.Clear(); Console.WriteLine("Balance: " + money + "$"); Console.WriteLine(); Console.WriteLine("Bet: " + bet + "$"); Console.WriteLine(); break; case 3: money = money - 20; bet = bet + 20; Console.Clear(); Console.WriteLine("Balance: " + money + "$"); Console.WriteLine(); Console.WriteLine("Bet: " + bet + "$"); Console.WriteLine(); break; case 4: bet = money; money = money - bet; Console.Clear(); Console.WriteLine("Balance: " + money + "$"); Console.WriteLine(); Console.WriteLine("Bet: " + bet + "$"); Console.WriteLine(); break; case 5: Console.WriteLine(); Console.WriteLine("Enter the amount:"); int customBet = Convert.ToInt32(Console.ReadLine()); money = money - customBet; bet = bet + customBet; Console.Clear(); Console.WriteLine("Balance: " + money + "$"); Console.WriteLine(); Console.WriteLine("Bet: " + bet + "$"); Console.WriteLine(); break; case 6: gameChoice gameChoice = new gameChoice(); gameChoice.Main(); Console.Clear(); break; } } } public class coinFlip { public static void Flip() { Console.Clear(); Console.WriteLine("Minigame: Coin Flip"); Console.WriteLine(); Betting.placeBet(); Random rand = new Random(); int flipResult = rand.Next(1, 101); // 50/50 chance Console.WriteLine("Flipping the coin..."); Console.WriteLine(); System.Threading.Thread.Sleep(2000); // Flipping time if (flipResult > 50) // makes it 49/51 chance, beacuse the house always wins >:D { Console.WriteLine("It's Heads! You win!"); Betting.money = Betting.money + (Betting.bet * 2); Console.WriteLine(); Console.WriteLine("Balance: " + Betting.money + "$"); } else { Console.WriteLine("It's Tails! You lose!"); Console.WriteLine(); Console.WriteLine("Balance: " + Betting.money + "$"); } Console.WriteLine(); gameChoice gameChoice = new gameChoice(); gameChoice.Main(); } } public class blackJack { public static void Play() { Console.Clear(); Console.WriteLine("Minigame: BlackJack"); Console.WriteLine(); Betting.placeBet(); string[] cardHandNPC; cardHandNPC = new string[4]; string rndType = null; //Dealer NPC string[] cardTypeArrayNPC; cardTypeArrayNPC = new string[4]; string[] cardHand; cardHand = new string[4]; //Player string[] cardTypeArray; cardTypeArray = new string[4]; Random rand = new Random(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Dealing NPC`s cards..."); Console.WriteLine(); System.Threading.Thread.Sleep(2000); // Card giving time bool karts1CheckedNPC = false; //Makes bools to check players cards bool karts2CheckedNPC = false; bool karts3CheckedNPC = false; for (int i = 0; i < 3; i++) //NPC card random { int rndTypeRow = rand.Next(0, 4); int rndValue = rand.Next(0, 13); Cards Cards = new Cards(); string rndCard = Cards.cards[rndTypeRow, rndValue]; if (rndTypeRow == 0) { rndType = "Hearts"; } else if (rndTypeRow == 1) { rndType = "Diamonds"; } else if (rndTypeRow == 2) { rndType = "Clubs"; } else if (rndTypeRow == 3) { rndType = "Spades"; } cardHandNPC[i] = rndCard; cardTypeArrayNPC[i] = rndType; //Continue here by making the calculation for the current hands value } Console.WriteLine("NPC kartis: " + cardHandNPC[0] + cardTypeArrayNPC[0] + " " + cardHandNPC[1] + cardTypeArrayNPC[1]); karts1CheckedNPC = true; //Checks the first 2 NPC cards given karts2CheckedNPC = true; Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Dealing cards..."); Console.WriteLine(); System.Threading.Thread.Sleep(1500); // Card giving time bool karts1Checked = false; //Makes bools to check players cards bool karts2Checked = false; bool karts3Checked = false; for (int i = 0; i < 3; i++) //Player card random { int rndTypeRow = rand.Next(0, 4); int rndValue = rand.Next(0, 13); Cards Cards = new Cards(); string rndCard = Cards.cards[rndTypeRow, rndValue]; if (rndTypeRow == 0) { rndType = "Hearts"; } else if (rndTypeRow == 1) { rndType = "Diamonds"; } else if (rndTypeRow == 2) { rndType = "Clubs"; } else if (rndTypeRow == 3) { rndType = "Spades"; } cardHand[i] = rndCard; cardTypeArray[i] = rndType; } Console.Write("Tavas kartis: " + cardHand[0] + cardTypeArray[0] + " "); System.Threading.Thread.Sleep(1500); // Card giving time Console.Write(cardHand[1] + cardTypeArray[1]); karts1Checked = true; //Checks the first 2 player cards given karts2Checked = true; System.Threading.Thread.Sleep(1000); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("(1) - Hit"); Console.WriteLine("(2) - Stand"); Console.WriteLine("(3) - Double"); int choice = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(); switch (choice) { case 1: karts3Checked = true; Console.WriteLine("Tavas kartis: " + cardHandNPC[0] + cardTypeArrayNPC[0] + " " + cardHandNPC[1] + cardTypeArrayNPC[1] + " "); Console.WriteLine("Dealing cards..."); System.Threading.Thread.Sleep(1500); // Card giving time Console.Clear(); Console.WriteLine("NPC kartis: " + cardHandNPC[0] + cardTypeArrayNPC[0] + " " + cardHandNPC[1] + cardTypeArrayNPC[1] + " " + cardHandNPC[2] + cardTypeArrayNPC[2]); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Tavas kartis: " + cardHandNPC[0] + cardTypeArrayNPC[0] + " " + cardHandNPC[1] + cardTypeArrayNPC[1]); break; case 2: karts3CheckedNPC = true; Console.WriteLine("NPC kartis: " + cardHandNPC[0] + cardTypeArrayNPC[0] + " " + cardHandNPC[1] + cardTypeArrayNPC[1] + " " + cardHandNPC[2] + cardTypeArrayNPC[2]); break; case 3: break; } Console.WriteLine(); gameChoice gameChoice = new gameChoice(); gameChoice.Main(); } } }