private void callButton_Click(object sender, EventArgs e) { if (Wager.bankrupt(round)) { showMessage("Insufficient Funds"); } else if (busy) { showMessage("Please Wait"); } else if (round.playerHand == null) { showMessage("Place Bet First"); } else { setInfo(gameInfo, "Dealer Calls"); Debug.WriteLine("Dealer Calls"); placeBet(bet, 0); //dealer is always 0 round.Call(); setInfo(dealerInfo, $"Win Odds: {round.player[0].winOdds * 100}%\n{round.player[0].handType}\nCards: {round.deck.Count}"); busy = true; //the system is now busy doCall(); } }
private void betButton_Click(object sender, EventArgs e) { if (Wager.bankrupt(round)) { showMessage("Insufficient Funds"); } else if (round.turn > 0) { showMessage("Finish Round First"); } else if (busy) { showMessage("Please Wait"); } else if (round.deck.Count < 5 + 2 * round.numPlayers) { showMessage("Insufficient Cards"); } else { //cleans up the board Clean(false); setInfo(gameInfo, $"Dealer Bets ${bet}"); Debug.WriteLine($"Dealer Bets ${bet}"); //everyone makes an inital bet and can play for (int index = 0; index < round.numPlayers; index++) { placeBet(bet, index); round.player[index].canPlay = true; } dealerInfo.Visible = true; potMoney.Visible = true; round.Bet(); //does a betting round if (debugWindow != null) { updateTelemetry(); } setInfo(dealerInfo, $"Win Odds: {round.player[0].winOdds * 100}%\n{round.player[0].handType}\nCards: {round.deck.Count}"); updateTable(); busy = true; //the system is now busy int num = 1; //used to keep track of delays foreach (var player in round.player) { if (player.canPlay && player.index > 0) { Task.Delay(num * delay).ContinueWith(t => Bet(player.index)); num++; } } } }