예제 #1
0
 private void UpdateRound()
 {
     round++;
     label16.Text = Convert.ToString(round);
     UpdateScore();
     if (EndGame())
     {
         label16.Text = "Done";
         int        num  = Convert.ToInt32(label10.Text);
         int        num1 = Convert.ToInt32(label14.Text);
         int        num2 = Convert.ToInt32(label11.Text);
         Player     a    = (Player)players[0];
         CPU_Player b    = (CPU_Player)players[1];
         CPU_Player c    = (CPU_Player)players[2];
         string     s;
         if (num > num1)
         {
             if (num > num2)
             {
                 s = "Winner is " + a.D_name;
             }
             else if (num == num2)
             {
                 s = "We have a tie!";
             }
             else
             {
                 s = "Winner is " + c.D_Name;
             }
         }
         else
         {
             if (num == num1 && num1 > num2)
             {
                 s = "We have a tie!";
             }
             else if (num1 == num2)
             {
                 s = "We have a three-way tie!";
             }
             else if (num1 < num2)
             {
                 s = "Winner is " + c.D_Name;
             }
             else
             {
                 if (num1 > num2)
                 {
                     s = "Winner is " + b.D_Name;
                 }
                 else
                 {
                     s = "Winner is " + c.D_Name;
                 }
             }
         }
         MessageBox.Show(s, "We have a winner!");
         Reset();
     }
 }
예제 #2
0
        private void Run_Next()
        {
            CPU_Player temp = (CPU_Player)players[counter % 3];
            Player     p    = (Player)players[0];
            int        rand;

            if (counter % 3 == 1)
            {
                if (p.D_choice == 'E')
                {
                    rand = q.Next(20, 60);
                    if (rand > 45)
                    {
                        temp.D_Choice = 'E';
                    }
                    else
                    {
                        temp.D_Choice = 'C';
                    }
                }
                else
                {
                    temp.D_Choice = 'C';
                }
            }
            if (counter % 3 == 2)
            {
                rand = q.Next(1, 4);
                if (rand == 2)
                {
                    temp.D_Choice = 'C';
                }
                else
                {
                    temp.D_Choice = 'E';
                }
            }
            pictureBox1.Image = temp.This_Pic;
            label3.Text       = temp.D_Name + "'s";
            RandomQuotes(temp.D_Choice);
            Console.Write(counter);
            counter++;
        }
예제 #3
0
        public void UpdateScore()
        {
            //All exploits (3,5,2)
            //Player Chill, both CPU exploits (-3, 4, 2)
            //Player and CPU2 exploits, CPU1 chills (4,6,4)
            //Player and CPU1 chills, CPU2 Exploits (1,-1,2)

            //Player and CPU1 exploits, CPU2 Chills (-2,-4,1)
            //Player and CPU2 chills, CPU1 exploits (2,1,3)
            //Player exploits, CPU1 and CPU2 chills (3,2,-1)
            //All chills (2,2,2)
            Player     a    = (Player)players[0];
            CPU_Player b    = (CPU_Player)players[1];
            CPU_Player c    = (CPU_Player)players[2];
            int        num  = Convert.ToInt32(label10.Text);
            int        num1 = Convert.ToInt32(label14.Text);
            int        num2 = Convert.ToInt32(label11.Text);

            //10,14,11 labelbox
            switch (a.D_choice)
            {
            case 'E':
                if (b.D_Choice == 'E')
                {
                    if (c.D_Choice == 'E')
                    {
                        num                += 3;
                        num1               += 5;
                        num2               += 2;
                        label10.Text        = Convert.ToString(num);
                        label14.Text        = Convert.ToString(num1);
                        label11.Text        = Convert.ToString(num2);
                        textBox10.BackColor = Color.Yellow;
                    }
                    if (c.D_Choice == 'C')
                    {
                        num               += -2;
                        num1              += -4;
                        num2              += 1;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox9.BackColor = Color.Yellow;
                    }
                }
                if (b.D_Choice == 'C')
                {
                    if (c.D_Choice == 'E')
                    {
                        num               += 4;
                        num1              += 6;
                        num2              += 4;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox5.BackColor = Color.Yellow;
                    }
                    if (c.D_Choice == 'C')
                    {
                        num               += 3;
                        num1              += 2;
                        num2              += -1;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox6.BackColor = Color.Yellow;
                    }
                }
                break;

            case 'C':
                if (b.D_Choice == 'E')
                {
                    if (c.D_Choice == 'E')
                    {
                        num               += -3;
                        num1              += 4;
                        num2              += 2;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox3.BackColor = Color.Yellow;
                    }
                    if (c.D_Choice == 'C')
                    {
                        num               += 2;
                        num1              += 1;
                        num2              += 3;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox4.BackColor = Color.Yellow;
                    }
                }
                if (b.D_Choice == 'C')
                {
                    if (c.D_Choice == 'E')
                    {
                        num               += 1;
                        num1              += -1;
                        num2              += 2;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox7.BackColor = Color.Yellow;
                    }
                    if (c.D_Choice == 'C')
                    {
                        num               += 2;
                        num1              += 2;
                        num2              += 2;
                        label10.Text       = Convert.ToString(num);
                        label14.Text       = Convert.ToString(num1);
                        label11.Text       = Convert.ToString(num2);
                        textBox8.BackColor = Color.Yellow;
                    }
                }
                break;
            }
        }