コード例 #1
0
        private void Tournament1_Click(object sender, EventArgs e)
        {
            Form TournamentOne = new TournamentOne();

            this.Close();
            TournamentOne.Show();
        }
コード例 #2
0
        }//end of gameLoop() method.

        public void initializeGame(TournamentOne f)
        {
            if (gameCount == 0)
            {
                board   = new List <Card>();
                players = new List <Player>();
                for (int i = 0; i < 9; i++)
                {
                    Player p = new Player();
                    p.setName("Player " + i.ToString());
                    addPlayer(p);
                    f.Refresh();//se kathe round
                }
                gameCount = gameCount + 1;
            }

            else
            {
                for (int i = 0; i < 9; i++)
                {
                    if (players[i].getChips() > 0)
                    {
                        players[i].setPlayerToActive();
                        activeNumber++;
                    }
                    else
                    {
                        players[i].setInnactive();
                    }
                }
                if (activeNumber == 1)
                {
                    winner();
                    TournamentOne asd = new TournamentOne();
                    tourlist.Add(asd);
                    initializeGame(tourlist[tourlist.Count()]);
                    gameCount = 0;

                    smallBlind  = 0;
                    boardActive = false;
                    board       = new List <Card>();
                }
                activeNumber = 0;
            }

            TournamentOne newForm = new TournamentOne();

            tourlist.Add(newForm);
            tourlist[tourlist.Count() - 1].Show();
            f.Close();

            deal();
        }//end of gameLoop
コード例 #3
0
        // game looop STARTS HERE
        public void gameLoop(TournamentOne f)
        {
            if (gameCount > 1 && roundCount == 0)
            {
                board      = new List <Card>();
                smallBlind = smallBlind * gameCount;
            }

            // simulates every computer player one round
            if (roundCount <= 0)
            {
                players[blindCounter].setChips((players[0].getChips()) - smallBlind);
                players[blindCounter + 1].setChips((players[0].getChips()) - smallBlind * 2);
                players[blindCounter].setPlayerPot(smallBlind);
                players[blindCounter + 1].setPlayerPot(smallBlind * 2);
                blindCounter = blindCounter + 1;
                if (blindCounter > 9)
                {
                    blindCounter = 0;
                }
                for (int i = 1; i < 9; i++)
                {
                    if (players[i].checkIfActive())
                    {
                        computerPlayerTalk(players[i]);
                    }
                }
                roundCount = roundCount + 1;
                TournamentOne newForm = new TournamentOne();
                tourlist.Add(newForm);
                tourlist[tourlist.Count() - 1].Show();
                if ((tourlist.Count() - 2) < 0)
                {
                    f.Close();
                }
                else
                {
                    tourlist[tourlist.Count() - 2].Close();
                }
            }
            else if (roundCount == 1)
            {
                for (int i = 1; i < 9; i++)
                {
                    if (players[i].checkIfActive())
                    {
                        computerPlayerTalk(players[i]);
                    }
                }
                board       = deck.dealBoard();
                boardActive = true;
                roundCount  = roundCount + 1;
                TournamentOne newForm = new TournamentOne();
                tourlist.Add(newForm);
                tourlist[tourlist.Count() - 1].Show();
                if ((tourlist.Count() - 2) < 0)
                {
                    f.Hide();
                }
                else
                {
                    tourlist[tourlist.Count() - 2].Close();
                }
            }
            else if (roundCount == 2)
            {
                for (int i = 1; i < 9; i++)
                {
                    if (players[i].checkIfActive())
                    {
                        computerPlayerTalk(players[i]);
                    }
                }
                roundCount = roundCount + 1;
                TournamentOne newForm = new TournamentOne();
                tourlist.Add(newForm);
                tourlist[tourlist.Count() - 1].Show();
                if ((tourlist.Count() - 2) < 0)
                {
                    f.Hide();
                }
                else
                {
                    tourlist[tourlist.Count() - 2].Close();
                }
            }
            else if (roundCount == 3)
            {
                for (int i = 1; i < 9; i++)
                {
                    if (players[i].checkIfActive())
                    {
                        computerPlayerTalk(players[i]);
                    }
                }
                roundCount = roundCount + 1;
                TournamentOne newForm = new TournamentOne();
                tourlist.Add(newForm);
                tourlist[tourlist.Count() - 1].Show();
                if ((tourlist.Count() - 2) < 0)
                {
                    f.Hide();
                }
                else
                {
                    tourlist[tourlist.Count() - 2].Close();
                }
            }
            else if (roundCount == 4)
            {
                for (int i = 1; i < 9; i++)
                {
                    if (players[i].checkIfActive())
                    {
                        computerPlayerTalk(players[i]);
                    }
                }
                roundCount = roundCount + 1;
                TournamentOne newForm = new TournamentOne();
                tourlist.Add(newForm);
                tourlist[tourlist.Count() - 1].Show();
                if ((tourlist.Count() - 2) < 0)
                {
                    f.Hide();
                }
                else
                {
                    tourlist[tourlist.Count() - 2].Close();
                }
            }
            else if (roundCount > 4)
            {
                for (int i = 1; i < 9; i++)
                {
                    if (players[i].checkIfActive())
                    {
                        computerPlayerTalk(players[i]);
                    }
                    if (activePlayersNumber < 2)
                    {
                        roundCount = 0;
                    }
                }
                for (int j = 0; j < 9; j++)
                {
                    if (!players[j].checkIfActive())
                    {
                        activePlayersNumber = activePlayersNumber - 1;
                    }
                }
                if (activePlayersNumber == 0)
                {
                    if ((tourlist.Count() - 2) < 0)
                    {
                        f.Hide();
                    }
                    else
                    {
                        tourlist[tourlist.Count() - 2].Close();
                    }
                }
                for (int i = 0; i < 9; i++)
                {
                    players[i].setPlayerPot(players[i].getPlayerPot());
                }
                roundCount          = 0;
                activePlayersNumber = 9;
                gameCount           = gameCount + 1;
                boardActive         = false;
                TournamentOne newForm = new TournamentOne();
                tourlist.Add(newForm);
                tourlist[tourlist.Count() - 1].Show();
                if ((tourlist.Count() - 2) < 0)
                {
                    f.Close();
                }
                else
                {
                    tourlist[tourlist.Count() - 2].Close();
                }
            }
        }//end of gameLoop() method.