예제 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            count++;
            Random R = new Random();
            int    i = R.Next(1, 4);

            int k = R.Next(4, 7);


            if (i == 1)
            {
                pictureBox1.Show();
                pictureBox2.Hide();
                pictureBox3.Hide();
                pictureBox4.Hide();
                pictureBox5.Hide();
                pictureBox6.Hide();
                if (k == 4)
                {
                    draw = true;
                    pictureBox2.Hide();
                    pictureBox3.Hide();
                    pictureBox4.Show();
                    pictureBox5.Hide();
                    pictureBox6.Hide();
                }
                if (k == 5)
                {
                    lose = true;
                    pictureBox2.Hide();
                    pictureBox3.Hide();
                    pictureBox4.Hide();
                    pictureBox5.Show();
                    pictureBox6.Hide();
                }
                if (k == 6)
                {
                    win = true;
                    pictureBox2.Hide();
                    pictureBox3.Hide();
                    pictureBox4.Hide();
                    pictureBox5.Hide();
                    pictureBox6.Show();
                }
            }
            if (i == 2)
            {
                pictureBox1.Hide();
                pictureBox2.Show();
                pictureBox3.Hide();
                pictureBox4.Hide();
                pictureBox5.Hide();
                pictureBox6.Hide();
                if (k == 4)
                {
                    win = true;

                    pictureBox3.Hide();
                    pictureBox4.Show();
                    pictureBox5.Hide();
                    pictureBox6.Hide();
                }
                if (k == 5)
                {
                    draw = true;

                    pictureBox3.Hide();
                    pictureBox4.Hide();
                    pictureBox5.Show();
                    pictureBox6.Hide();
                }
                if (k == 6)
                {
                    lose = true;

                    pictureBox3.Hide();
                    pictureBox4.Hide();
                    pictureBox5.Hide();
                    pictureBox6.Show();
                }
            }
            if (i == 3)
            {
                pictureBox1.Hide();
                pictureBox2.Hide();
                pictureBox3.Show();
                pictureBox4.Hide();
                pictureBox5.Hide();
                pictureBox6.Hide();
                if (k == 4)
                {
                    lose = true;
                    pictureBox2.Hide();

                    pictureBox4.Show();
                    pictureBox5.Hide();
                    pictureBox6.Hide();
                }
                if (k == 5)
                {
                    win = true;
                    pictureBox2.Hide();

                    pictureBox4.Hide();
                    pictureBox5.Show();
                    pictureBox6.Hide();
                }
                if (k == 6)
                {
                    draw = true;
                    pictureBox2.Hide();

                    pictureBox4.Hide();
                    pictureBox5.Hide();
                    pictureBox6.Show();
                }
            }
            if (count == 6)
            {
                this.timer1.Stop();
                this.Hide();
                Final F = new Final();
                S = score + " ";
                F.Show();
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (count <= 6)
            {
                if (userradioButton1.Checked)
                {
                    pictureBox1.Visible = true;
                    pictureBox2.Visible = false;
                    pictureBox3.Visible = false;
                    pictureBox4.Visible = false;
                    pictureBox5.Visible = false;
                    pictureBox6.Visible = false;
                    Random R1 = new Random();
                    int    i  = R1.Next(1, 4);
                    if (i == 1)
                    {
                        pictureBox2.Visible     = true;
                        pictureBox3.Visible     = false;
                        pictureBox4.Visible     = false;
                        pictureBox5.Visible     = false;
                        pictureBox6.Visible     = false;
                        comradioButton4.Checked = true;

                        label4.Text = "DRAW";
                    }
                    else if (i == 2)
                    {
                        pictureBox2.Visible     = false;
                        pictureBox3.Visible     = false;
                        pictureBox4.Visible     = false;
                        pictureBox5.Visible     = true;
                        pictureBox6.Visible     = false;
                        comradioButton5.Checked = true;


                        label4.Text = "YOU LOSE";
                        score       = score + 1;
                    }
                    else
                    {
                        pictureBox2.Visible     = false;
                        pictureBox3.Visible     = false;
                        pictureBox4.Visible     = false;
                        pictureBox5.Visible     = false;
                        pictureBox6.Visible     = true;
                        comradioButton6.Checked = true;
                        label4.Text             = "YOU WIN THIS TIME";
                    }
                    count = count + 1;
                }
                if (userradioButton2.Checked)
                {
                    pictureBox1.Visible = false;
                    pictureBox2.Visible = false;
                    pictureBox3.Visible = true;
                    pictureBox4.Visible = false;
                    pictureBox5.Visible = false;
                    pictureBox6.Visible = false;
                    Random R2 = new Random();
                    int    i  = R2.Next(1, 4);
                    if (i == 1)
                    {
                        pictureBox1.Visible = false;
                        pictureBox2.Visible = true;

                        pictureBox4.Visible     = false;
                        pictureBox5.Visible     = false;
                        pictureBox6.Visible     = false;
                        comradioButton4.Checked = true;

                        label4.Text = "YOU WIN THIS TIME"; score = score + 1;
                    }
                    else if (i == 2)
                    {
                        pictureBox1.Visible = false;
                        pictureBox2.Visible = false;

                        pictureBox4.Visible     = false;
                        pictureBox5.Visible     = true;
                        pictureBox6.Visible     = false;
                        comradioButton5.Checked = true;
                        label4.Text             = "DRAW";
                    }
                    else
                    {
                        pictureBox1.Visible = false;
                        pictureBox2.Visible = false;

                        pictureBox4.Visible     = false;
                        pictureBox5.Visible     = false;
                        pictureBox6.Visible     = true;
                        comradioButton6.Checked = true;
                        label4.Text             = "YOU LOSE";
                    }
                    count = count + 1;
                }
                if (userradioButton3.Checked)
                {
                    pictureBox1.Visible = false;
                    pictureBox2.Visible = false;
                    pictureBox3.Visible = false;
                    pictureBox4.Visible = true;
                    pictureBox5.Visible = false;
                    pictureBox6.Visible = false;
                    Random R3 = new Random();
                    int    i  = R3.Next(1, 4);
                    if (i == 1)
                    {
                        pictureBox1.Visible = false;
                        pictureBox2.Visible = true;
                        pictureBox3.Visible = false;

                        pictureBox5.Visible     = false;
                        pictureBox6.Visible     = false;
                        comradioButton4.Checked = true;
                        label4.Text             = "YOU LOSE";
                    }
                    else if (i == 2)
                    {
                        pictureBox1.Visible = false;
                        pictureBox2.Visible = false;
                        pictureBox3.Visible = false;

                        pictureBox5.Visible     = true;
                        pictureBox6.Visible     = false;
                        comradioButton5.Checked = true;

                        label4.Text = "YOU WIN THIS TIME"; score = score + 1;
                    }
                    else
                    {
                        pictureBox1.Visible = false;
                        pictureBox2.Visible = false;
                        pictureBox3.Visible = false;

                        pictureBox5.Visible = false;
                        pictureBox6.Visible = true;

                        comradioButton6.Checked = true;
                        label4.Text             = "DRAW";
                    }
                    count = count + 1;
                }
            }
            else
            {
                Final F = new Final();
                S = score + " ";

                F.Show();
                this.Hide();
            }
        }