コード例 #1
0
ファイル: Wager.cs プロジェクト: pieiscool32/CIS-279
 public static bool bankrupt(PokerRound round)
 {
     foreach (var bank in round.money)
     {
         if (bank <= 0)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
ファイル: Wager.cs プロジェクト: pieiscool32/CIS-279
        public static bool IsLast(PokerRound round, int index)
        {
            int go = 0;

            foreach (var player in round.player)
            {
                if (player.canPlay && player.index > index)
                {
                    go++;
                }
            }
            return(go == 0 ? true : false);
        }
コード例 #3
0
ファイル: Wager.cs プロジェクト: pieiscool32/CIS-279
        public static bool canPlay(PokerRound round, bool autopilot)
        {
            int count = 0;

            foreach (var player in round.player)
            {
                if (!player.canPlay)
                {
                    count++;
                }
            }
            int modifier = autopilot ? 0 : 1;

            return(count == round.numPlayers - modifier ? false : true);
        }
コード例 #4
0
ファイル: GameForm.cs プロジェクト: pieiscool32/CIS-279
        private void Clean(bool all)
        {
            if (all)
            {
                RandomGen rand = new RandomGen();
                round = new PokerRound(rand, 2);
                round.Done();
                round.money.Add(startMoney);
                round.money.Add(startMoney);
                pot = 0;
                foreach (var card in table)
                {
                    card.Image = null;
                }
                cardOne.Image = null;
                cardTwo.Image = null;

                dealerInfo.Visible  = false;
                debug.Visible       = false;
                potMoney.Visible    = false;
                playerCount.Visible = false;
                betButton.Text      = $"Bet ${bet}";
                busy      = false;
                autopilot = false;
            }
            else
            {
                turn.Image       = null;
                river.Image      = null;
                potMoney.Visible = true;
            }
            foreach (var card in table)
            {
                setBorder(card, BorderStyle.None);
            }
            setBorder(cardOne, BorderStyle.None);
            setBorder(cardTwo, BorderStyle.None);
            dealerMoney.Text = $"Bank: ${round.money[0]}";
            gameInfo.Text    = all ? "Welcome" : gameInfo.Text;
        }
コード例 #5
0
ファイル: Wager.cs プロジェクト: pieiscool32/CIS-279
        public static List <int> winner(PokerRound round)
        {
            List <int> winnr = new List <int>();
            int        score = 0;

            for (int index = 0; index < round.numPlayers; index++)
            {
                if (round.player[index].bestScore > score && round.player[index].canPlay)
                {
                    score = round.player[index].bestScore;
                }
            }

            foreach (var player in round.player)
            {
                if (player.bestScore == score && player.canPlay)
                {
                    winnr.Add(player.index);
                }
            }

            return(winnr);
        }