コード例 #1
0
ファイル: GameForm.cs プロジェクト: pieiscool32/CIS-279
 private void Bet(int index)
 {
     //Used by the bots only
     Debug.WriteLine($"Computer{index} has {round.player[index].bestScore} @ {round.player[index].winOdds * 100}%");
     //If the odds of winning are above the threshold
     if (round.player[index].winOdds >= betFold)
     {
         setInfo(gameInfo, $"Computer{index} Raises");
         Debug.WriteLine($"Computer{index} Raises ${bet}");
         placeBet(bet, index);
     }
     else
     {
         setInfo(gameInfo, $"Computer{index} Folds");
         Debug.WriteLine($"Computer{index} Folds");
         round.player[index].canPlay = false;
     }
     if (!Wager.canPlay(round, autopilot))
     {
         Task.Delay(delay).ContinueWith(t => payWinner(Wager.winner(round)));
     }
     else if (Wager.IsLast(round, index))
     {
         busy = false;
     }
 }
コード例 #2
0
ファイル: GameForm.cs プロジェクト: pieiscool32/CIS-279
        private void Call(int index)
        {
            //Used by the bots only
            if (round.player[index].canPlay)
            {
                Debug.WriteLine($"Computer{index} has {round.player[index].bestScore} @ {round.player[index].winOdds * 100}%");
                //If the odds of winning are above the threshold
                if (round.player[index].winOdds >= callFold)
                {
                    setInfo(gameInfo, $"Computer{index} Raises");
                    Debug.WriteLine($"Computer{index} Raises ${bet}");
                    placeBet(bet, index);
                }
                else
                {
                    setInfo(gameInfo, $"Computer{index} Folds");
                    Debug.WriteLine($"Computer{index} Folds");
                    round.player[index].canPlay = false;
                    if (!Wager.canPlay(round, autopilot) && autopilot)
                    {
                        Task.Delay(delay).ContinueWith(t => payWinner(new List <int>()
                        {
                            index
                        }));
                    }
                }
            }
            bool last = Wager.IsLast(round, index);

            if (!Wager.canPlay(round, autopilot) && !autopilot)
            {
                Task.Delay(delay).ContinueWith(t => payWinner(Wager.winner(round)));
            }
            else if (round.turn == 3 && last)
            {
                Task.Delay(delay).ContinueWith(t => payWinner(Wager.winner(round)));
            }
            else if (autopilot && last)
            {
                if (Wager.canPlay(round, autopilot))
                {
                    round.player[index].canPlay = false;
                    if (!Wager.canPlay(round, autopilot))
                    {
                        Task.Delay(delay).ContinueWith(t => payWinner(new List <int>()
                        {
                            index
                        }));
                    }
                    else
                    {
                        round.player[index].canPlay = true;
                        Debug.WriteLine("Autopilot Advances");
                        round.Call();
                        updateTable();
                        updateTelemetry();
                        setInfo(gameInfo, "River Revealed");
                        Debug.WriteLine("River Revealed");
                        Task.Delay(delay).ContinueWith(t => doCall());
                    }
                }
            }
            else if (last)
            {
                busy = false;
            }
        }