public static Boolean battle(PlayingCard p1, PlayingCard cpu) { Boolean win = false; int plValue = p1.cardValue; int cpuValue = cpu.cardValue; int plSuit = p1.suitValue; int cpuSuit = cpu.suitValue; if (plValue < cpuValue) { win = false; } else if (plValue > cpuValue) { win = true; } else { Console.WriteLine("WAR!!!!!!!!!\n"); if (plSuit < cpuSuit) { win = false; } else if (plSuit > cpuSuit) { win = true; } } if (win == true) { Console.WriteLine("You Win!!!\n"); } if (win == false) { Console.WriteLine("You lose :((((\n"); } return(win); }
public static Boolean getCardsFromHand(HandOfCards gameHand) { Random rnd = new Random(); int playerNumber = rnd.Next(0, 4); int cpuNumber = rnd.Next(0, 4); do { cpuNumber = rnd.Next(0, 4); } while (cpuNumber == playerNumber); PlayingCard myCard = gameHand.gameHand1[playerNumber]; PlayingCard cpuCard = gameHand.gameHand1[cpuNumber]; Console.WriteLine("---------------------------------"); Console.WriteLine("You drew a {0} of {1}\n", myCard.strCardValue, myCard.strSuitValue); Console.WriteLine("CPU drew a {0} of {1}\n", cpuCard.strCardValue, cpuCard.strSuitValue); Boolean didWin = battle(myCard, cpuCard); return(didWin); }