예제 #1
0
 private void button10_Click(object sender, EventArgs e)
 {
     pokerTable.getPlayers().Clear();
     numberOFPlayers = Convert.ToInt32(nudAmount.Value);
     PlayerList players = new PlayerList();
     Random rand = new Random();
     for (int i = 0; i < numberOFPlayers; i++)
     {
         players.Add(new Player("Player " + (i + 1), 10000));
     }
     players[0].ChipStack = 10000;
     players[1].ChipStack = 9000;
     players[2].ChipStack = 9500;
     players[3].ChipStack = 9500;
     pokerTable = new Table(players);
     Print();
 }
예제 #2
0
        //the all important constructors
        public FormPoker()
        {
            InitializeComponent();
            this.Icon = new Icon("Poker.ico");
            timerCount = 0;
            screenWidth = Screen.PrimaryScreen.Bounds.Width;
            screenHeight = Screen.PrimaryScreen.Bounds.Height;
            width_ratio = (screenWidth / this.Width);
            height_ratio = (screenHeight / this.Height);

            SizeF scale = new SizeF(width_ratio, height_ratio);
            pbMain.Scale(scale);
            this.Size = pbMain.Size;
            foreach (Control control in this.Controls)
            {
                control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
            }
            cardWidth = Convert.ToInt32(71f * width_ratio);
            cardHeight = Convert.ToInt32(96f * height_ratio);
            user = new UserAccount();
            Random rand = new Random();
            Player me = new Player(playerName, BuyInAmount);
            playerList = new PlayerList();
            playerList.Add(me);
            lblName.Text = me.Name;
            List<int> AI = new List<int>(playerAmount);
            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(BuyInAmount, difficulty, AI[i - 1]));
                //labelListName[i].Text = playerList[i].Name;
            }
            FormInformation Information = new FormInformation(playerList);
            Information.StartPosition = FormStartPosition.CenterScreen;
            Information.ShowDialog();
            Information.Dispose();
            pokerTable = new Table(playerList);
            SoundPlayer sound = new SoundPlayer();
        }
예제 #3
0
        public FormPoker(string playerName, int BuyInAmount, int playerAmount, int difficulty, UserAccount user)
        {
            InitializeComponent();
            this.Icon = new Icon("Poker.ico");
            this.playerName = playerName;
            if (playerName == null)
                throw new ArgumentOutOfRangeException();
            if (playerAmount < 2)
                throw new ArgumentOutOfRangeException();
            this.difficulty = difficulty;
            if (difficulty > 2)
                throw new ArgumentOutOfRangeException();
            this.BuyInAmount = BuyInAmount;
            this.playerAmount = playerAmount;
            timerCount = 0;
            //code to resize screen
            screenWidth = Screen.PrimaryScreen.Bounds.Width;
            screenHeight = Screen.PrimaryScreen.Bounds.Height;
            width_ratio = (screenWidth / 1366f);
            height_ratio = (screenHeight / 768f);
            SizeF scale = new SizeF(width_ratio, height_ratio);
            this.Scale(scale);
            foreach (Control control in this.Controls)
            {
                control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
            }

            cardWidth = Convert.ToInt32(71f * width_ratio);
            cardHeight = Convert.ToInt32(96f * height_ratio);
            this.user = new UserAccount(user);
            //add 3 archetytes randomly to list
            Random rand = new Random();
            Player me = new Player(playerName, BuyInAmount);
            playerList = new PlayerList();
            playerList.Add(me);
            lblName.Text = me.Name;
            List<int> AI = new List<int>(playerAmount);
            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(BuyInAmount, difficulty, AI[i - 1]));
                //labelListName[i].Text = playerList[i].Name;
            }
            FormInformation Information = new FormInformation(playerList);
            Information.StartPosition = FormStartPosition.CenterScreen;
            Information.ShowDialog();
            Information.Dispose();
            pokerTable = new Table(playerList);
        }
예제 #4
0
 private void btnPlayers_Click(object sender, EventArgs e)
 {
     playerList.Clear();
     lbMain.Items.Clear();
     playerAmount = Convert.ToInt32(nudPlayers.Value);
     Player user = new Player("Player", 50000);
     playerList.Add(user);
     List<int> AI = new List<int>(playerAmount);
     for (int i = 0; i < 3; i++)
     {
         AI.Add(i);
     }
     for (int i = 0; i < 4 - playerAmount; i++)
     {
         AI.Remove(rand.Next(AI.Count));
     }
     AI = shuffle(AI);
     for (int i = 1; i < playerAmount; i++)
     {
         playerList.Add(new AIPlayer(50000, 1, AI[i - 1]));
     }
     pokerTable = new Table(playerList);
     foreach (Player player in pokerTable)
     {
         lbMain.Items.Add(player.Name);
     }
     lbMain.SelectedIndex = rand.Next(lbMain.Items.Count - 1) + 1;
 }