关闭

C#第六次作业:猜猜看

153人阅读 评论(0) 收藏 举报
分类:
using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Threading.Tasks;  
using System.Windows.Forms;  
using System.IO;  
using System.Data.SqlClient;  
  
namespace makeguess
{  
    public partial class Form1 : Form  
    {  
        public Form1()  
        {  
            InitializeComponent();  
        }  
        int model = new int();                            
        int[] sumHeroPhoto = new int[125];                  
        int[] modelTwoName = new int[125];                  
  
        String[] sumHeroNames=new String[125];     
        int m,n ;                                  
        int p1, p2;                                 
        int t = 0;                                
        int t2 = 0;                             
  
        int x1,x2,x3;              
        int[] num = new int[3];   
        int[] num2 = new int[3];  
        bool re_elect=new bool();  
  
        float[] percent = new float[125];      
        float[] percent2 = new float[125];    
        int[] trueGuessNum = new int[125];     
        int[] trueGuessPhoto = new int[125];   
        int[] tp = new int[125];              
        int[] tp2 = new int[125];             
  
        int m0, m1, m2, m3, m4, m5;           
        int n0, n1, n2, n3, n4, n5;           
  
    
        int[] ci_keNum = new int[15];  
        int[] tan_keNum = new int[16];  
        int[] she_shouNum = new int[19];  
        int[] zhan_shiNum = new int[36];  
        int[] fa_shiNum = new int[28];  
        int[] fu_zhuNum = new int[11];  
  
        /  
        int[] ci_keNum2 = new int[15];  
        int[] tan_keNum2 = new int[16];  
        int[] she_shouNum2 = new int[19];  
        int[] zhan_shiNum2 = new int[36];  
        int[] fa_shiNum2 = new int[28];  
        int[] fu_zhuNum2 = new int[11];  
  
        private void Form1_Load(object sender, EventArgs e)  
        {  
            modelOneVisible(false);  
            modelTwoVisible(false);  
            textBox1.ReadOnly = true;                
        
            getHeroName();  
            comboBox1.SelectedIndex=0;         
            comboBox1.SelectionChangeCommitted += new System.EventHandler(this.scc_Click);  
        }  
  
     
        private void modelOne_Click(object sender, EventArgs e)  
        {  
            model = 1;         
            // 连接数据库  
            String con = (@"server=LONG-PC\LONG;database=caicaikan;user id=sa;password=123456");  
            SqlConnection conn = new SqlConnection(con);  
            // 读取数据库数据  
            conn.Open();  
            SqlCommand cmd = new SqlCommand();  
            cmd.CommandText = "select * from modelOne";  
            cmd.Connection = conn;  
            SqlDataAdapter da = new SqlDataAdapter(cmd);  
            DataSet ds = new DataSet();  
            da.Fill(ds);  
            DataTable dt = new DataTable();  
            dt = ds.Tables[0].Copy();  
            double[] a = new double[125];  
            for (int i = 0; i < 125; i++)  
            {  
                sumHeroPhoto[i] = (int)dt.Rows[i].ItemArray[0];  
                trueGuessNum[i] = (int)dt.Rows[i].ItemArray[1];  
  
                // 先将数据库中的float转换为c#中的double  
                a[i] = (double)dt.Rows[i].ItemArray[2];  
                percent[i] = (float)a[i];  
  
                tp[i] = (int)dt.Rows[i].ItemArray[3];  
            }  
            conn.Close();  
            conn.Dispose();                  //释放内存空  
  
            // 显示模式一的控件  
            modelOneVisible(true);  
            // 隐藏模式二相关控件  
            aRandomName.Visible = false;  
            pictureBox2.Visible = false;  
            pictureBox3.Visible = false;  
            pictureBox4.Visible = false;  
  
            randomHero();                           // 得到随机图片  
            messageRecord();                                  
            cleanRadio123();                        // 清空radiobutton选项  
            getThreeChecked();                      // 得到三个选项的值  
            continueGame.Visible = false;           // 隐藏继续游戏按钮  
            correctResult.Visible = false;          // 隐藏查看正确答案按钮  
            this.textBox1.Text = "请选择答案";  
            re_elect = false;                       // 默认没有重选  
            label4.Text = "选择答案查看";  
              
        }  
  
        // 第一个选项按钮  
        private void radioButton1_CheckedChanged(object sender, EventArgs e)  
        {  
            if (re_elect == true)    //检测是否重选  
            {  
                textBox1.Text = "只能选择一次";  
            }  
            else  
            {  
                if (num[x1] == t)  
                {  
                    textBox1.Text = "正确";  
                    trueGuessNum[num[x1]]++;  
                }  
                else  
                {  
                    textBox1.Text = "错误";  
                }  
            }  
            continueGame.Visible = true;    // 显示继续游戏按钮  
            correctResult.Visible = true;   // 查看正确答案按钮  
            re_elect = true;                // 打开检查重选  
            //计算认识率  
            percent[t] = (float)trueGuessNum[t] / (sumHeroPhoto[t] + 2);  
            label4.Text = percent[t].ToString("0.00%");                     
        }  
  
        // 第二个选项按钮  
        private void radioButton2_CheckedChanged(object sender, EventArgs e)  
        {  
            if (re_elect == true)  
            {  
                textBox1.Text = "只能选择一次";  
            }  
            else  
            {  
                if (num[x2] == t)  
                {  
                    textBox1.Text = "正确";  
                    trueGuessNum[num[x2]]++;  
                }  
                else  
                {  
                    textBox1.Text = "错误";  
                }  
            }  
  
            continueGame.Visible = true;  
            correctResult.Visible = true;    
            re_elect = true;  
  
            //计算认识率  
            percent[t] = (float)(trueGuessNum[t]) / (sumHeroPhoto[t] + 2);  
            label4.Text = percent[t].ToString("0.00%");             
        }  
  
        // 第三个选项按钮  
        private void radioButton3_CheckedChanged(object sender, EventArgs e)  
        {  
            if (re_elect == true)  
            {  
                textBox1.Text = "只能选择一次";  
            }  
            else  
            {  
                if (num[x3] == t)  
                {  
                    textBox1.Text = "正确";  
                    trueGuessNum[num[x3]]++;  
                }  
                else  
                {  
                    textBox1.Text = "错误";  
                }  
            }  
              
            continueGame.Visible = true;  
            correctResult.Visible = true;    
            re_elect = true;  
            //计算认识率  
            percent[t] =(float) trueGuessNum[t] / (sumHeroPhoto[t] + 2);  
            label4.Text = percent[t].ToString("0.00%");  
        }  
  
        // 继续游戏按钮  
        private void continueGame_Click(object sender, EventArgs e)  
        {  
            this.textBox1.Text = "请选择答案";  
            this.label4.Text = "选择答案查看";  
            re_elect = false;  
            if (model == 1)  
            {  
                switch (comboBox1.SelectedIndex)  
                {  
                    case 0:  
                         randomHero();  
                         getThreeChecked();  
                         cleanRadio123();  
                         messageRecord();  
                         this.textBox1.Text = "请选择答案";  
                         this.label4.Text = "选择答案查看";  
                         re_elect = false;  
                         break;  
  
                    case 1:  
                        getCi_ke();  
                        getThreeChecked();  
                        cleanRadio123();  
                        ci_keMessage();  
                        this.textBox1.Text = "请选择答案";  
                        this.label4.Text = "选择答案查看";  
                        re_elect = false;  
                        break;  
  
                    case 2:  
                        getTan_ke();  
                        getThreeChecked();  
                        cleanRadio123();  
                        tan_keMessage();  
                        this.textBox1.Text = "请选择答案";  
                        this.label4.Text = "选择答案查看";  
                        re_elect = false;  
                        break;  
  
                    case 3:  
                        getShe_shou();  
                        getThreeChecked();  
                        cleanRadio123();  
                        she_shouMessage();  
                        this.textBox1.Text = "请选择答案";  
                        this.label4.Text = "选择答案查看";  
                        re_elect = false;  
                        break;  
  
                    case 4:  
                        getZhan_shi();  
                        getThreeChecked();  
                        cleanRadio123();  
                        zhan_shiMessage();  
                        this.textBox1.Text = "请选择答案";  
                        this.label4.Text = "选择答案查看";  
                        re_elect = false;  
                        break;  
  
                    case 5:  
                        getFa_shi();  
                        getThreeChecked();  
                        cleanRadio123();  
                        fa_shiMessage();  
                        this.textBox1.Text = "请选择答案";  
                        this.label4.Text = "选择答案查看";  
                        re_elect = false;  
                        break;  
  
                    case 6:  
                        getFu_zhu();  
                        getThreeChecked();  
                        cleanRadio123();  
                        fu_zhuMessage();  
                        this.textBox1.Text = "请选择答案";  
                        this.label4.Text = "选择答案查看";  
                        re_elect = false;  
                        break;  
                }  
        
            }  
            else  
            {  
                switch (comboBox1.SelectedIndex)  
                {  
                    case 0:  
                        getName();                                  // 获得随机名字  
                        getThreeChecked2();                         // 获得3个选项  
                        messageRecord2();  
                        break;  
  
                    case 1:  
                        getCi_ke2();  
                        getThreeChecked2();                         // 获得3个选项  
                        ci_keMessage2();  
                        break;  
  
                    case 2:  
                        getTan_ke2();  
                        getThreeChecked2();  
                        tan_keMessage2();  
                        break;  
  
                    case 3:  
                        getShe_shou2();  
                        getThreeChecked2();  
                        she_shouMessage2();  
                        break;  
  
                    case 4:  
                        getZhan_shi2();  
                        getThreeChecked2();  
                        zhan_shiMessage2();  
                        break;  
  
                    case 5:  
                        getFa_shi2();  
                        getThreeChecked2();  
                        fa_shiMessage2();  
                        break;  
  
                    case 6:  
                        getFu_zhu2();  
                        getThreeChecked2();  
                        fu_zhuMessage2();  
                        break;  
                }  
            }  
        }  
  
      
        void getThreeChecked()  
        {  
            Random rn=new Random();  
            int p = randomHeroName1();  
            int q = randomHeroName2();  
  
            num[0] = t;  
            num[1] = p;  
            num[2] = q;  
           
            // 生成第一个选项  
            x1 = rn.Next(3);  
            radioButton1.Text = sumHeroNames[num[x1]].ToString();  
  
            // 生成第二个选项  
            x2 = rn.Next(3);  
            while (x2 == x1)   
            {  
                x2 = rn.Next(3);  
            }  
            radioButton2.Text = sumHeroNames[num[x2]].ToString();  
  
            // 生成第三个选项  
            x3 = rn.Next(3);  
            while (x3 == x1 || x3 == x2)       // 排除重复  
            {  
                x3 = rn.Next(3);  
            }  
            radioButton3.Text = sumHeroNames[num[x3]].ToString();  
        }  
  
     
        void modelOneVisible(bool mv)  
        {  
            if (mv == true)  
            {  
                pictureBox1.Visible = true;  
                label1.Visible = true;  
                label2.Visible = true;  
                label3.Visible = true;  
                label4.Visible = true;  
                radioButton1.Visible = true;  
                radioButton2.Visible = true;  
                radioButton3.Visible = true;  
                textBox1.Visible = true;  
                continueGame.Visible = false;  
                correctResult.Visible = false;  
                label6.Visible = true;  
                label7.Visible = true;  
                label8.Visible = true;  
                label9.Visible = true;  
                label10.Visible = true;  
                label11.Visible = true;  
                label12.Visible = true;  
                label13.Visible = true;  
                label14.Visible = true;  
                label15.Visible = true;  
                label16.Visible = true;  
                label17.Visible = true;  
                label18.Visible = true;  
                label19.Visible = true;                  
            }  
            else  
            {  
                pictureBox1.Visible = false;  
                label1.Visible = false;  
                label2.Visible = false;  
                label3.Visible = false;  
                label4.Visible = false;  
                radioButton1.Visible = false;  
                radioButton2.Visible = false;  
                radioButton3.Visible = false;  
                textBox1.Visible = false;  
                continueGame.Visible = false;  
                correctResult.Visible = false;  
                label6.Visible = false;  
                label7.Visible = false;  
                label8.Visible = false;  
                label9.Visible = false;  
                label10.Visible = false;  
                label11.Visible = false;  
                label12.Visible = false;  
                label13.Visible = false;  
                label14.Visible = false;  
                label15.Visible = false;  
                label16.Visible = false;  
                label17.Visible = false;  
                label18.Visible = false;  
                label19.Visible = false;  
            }  
        }  
  
       
        void cleanRadio123()  
        {  
            radioButton1.Checked = false;  
            radioButton2.Checked = false;  
            radioButton3.Checked = false;  
        }  
  
     
        void randomHero()  
        {  
            bool boo=new bool();  
            boo = true;         
            Random ran = new Random();             
            t = ran.Next(125);  
            while (t == m || t == n)  
            {  
                t = ran.Next(125);  
            }  
            imageList1.ImageSize = new Size(120, 120);  
  
           
            while (boo)  
            {  
                if (percent[t] >= 0.6)  
                {  
                    
                    if (percent[t] >= 0.99)  
                    {  
                        m5++;  
                        if (tp[t] == 9)  
                        {  
                            pictureBox1.Image = imageList1.Images[t];  
                            sumHeroPhoto[t]++;  
                            this.label3.Text = sumHeroPhoto[t].ToString();  
                            tp[t] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp[t]++;  
                            t = ran.Next(125);  
                        }  
                    }  
                   
                    if (percent[t] >= 0.9 && percent[t] < 0.99)  
                    {  
                        m4++;  
                        if (tp[t] == 4)  
                        {  
                            pictureBox1.Image = imageList1.Images[t];  
                            sumHeroPhoto[t]++;  
                            this.label3.Text = sumHeroPhoto[t].ToString();  
                            tp[t] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp[t]++;  
                            t = ran.Next(125);  
                        }  
                    }  
               
                    if (percent[t] >= 0.8 && percent[t] < 0.9)  
                    {  
                        m3++;  
                        if (tp[t] == 3)  
                        {  
                            pictureBox1.Image = imageList1.Images[t];  
                            sumHeroPhoto[t]++;  
                            this.label3.Text = sumHeroPhoto[t].ToString();  
                            tp[t] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp[t]++;  
                            t = ran.Next(125);  
                        }  
                    }  
                   
                    if (percent[t] >= 0.7 && percent[t] < 0.8)  
                    {  
                        m2++;  
                        if (tp[t] == 2)  
                        {  
                            pictureBox1.Image = imageList1.Images[t];  
                            sumHeroPhoto[t]++;  
                            this.label3.Text = sumHeroPhoto[t].ToString();  
                            tp[t] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp[t]++;  
                            t = ran.Next(125);  
                        }  
                    }  
                    
                    if (percent[t] >= 0.6 && percent[t] < 0.7)  
                    {  
                        m1++;  
                        if (tp[t] == 1)  
                        {  
                            pictureBox1.Image = imageList1.Images[t];  
                            sumHeroPhoto[t]++;  
                            this.label3.Text = sumHeroPhoto[t].ToString();  
                            tp[t] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp[t]++;  
                            t = ran.Next(125);  
                        }  
                    }  
                }  
               
                else  
                {                      
                    pictureBox1.Image = imageList1.Images[t];  
                    sumHeroPhoto[t]++;  
                    boo = false;  
                }  
            }  
            this.label3.Text = sumHeroPhoto[t].ToString();  
        }  
  
     
        void getHeroName()  
        {  
  
            StreamReader reader = new StreamReader(@"D:\c#\GuessFile\names.txt", Encoding.GetEncoding("gb2312"));  
  
            String line = reader.ReadLine();  
            int i = 0;  
            while (line != null)  
            {  
                sumHeroNames[i] = line;  
                i++;  
                line = reader.ReadLine();  
            }  
            reader.Close();  
        }  
  
       
        int randomHeroName1()  
        {  
            Random ran = new Random();  
            m = ran.Next(125);  
            while (m == n || m == t)  
            {  
                m = ran.Next(125);  
            }  
            return m;  
        }  
  
        
        int randomHeroName2()  
        {  
            Random ran = new Random();  
            n = ran.Next(125);  
            while(n == m||n==t)  
            {  
                n = ran.Next(125);  
            }  
            return n;  
        }  
  
         
        void getCi_ke()  
        {  
         
            int[] s = new int[] { 3, 4, 10, 12, 16, 22, 31, 33, 52, 87, 99, 107, 109, 115, 116 };  
            for (int i = 0; i < 15; i++)  
            {  
                ci_keNum[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(15);  
            t = ci_keNum[c];  
            imageList1.ImageSize = new Size(120, 120);  
            pictureBox1.Image = imageList1.Images[t];  
            sumHeroPhoto[t]++;  
            this.label3.Text = sumHeroPhoto[t].ToString();  
  
        }  
  
        
        void getTan_ke()  
        {  
      
            int[] s = new int[] { 18, 55, 56, 65, 66, 67, 69, 75, 78, 80, 81, 84, 91, 96, 108, 121 };  
            for (int i = 0; i < 16; i++)  
            {  
                tan_keNum[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(16);  
            t = tan_keNum[c];  
            imageList1.ImageSize = new Size(120, 120);  
            pictureBox1.Image = imageList1.Images[t];  
            sumHeroPhoto[t]++;  
            this.label3.Text = sumHeroPhoto[t].ToString();  
        }  
  
       
        void getShe_shou()  
        {  
        
            int[] s = new int[] { 1, 6, 13, 20, 24, 29, 35, 59, 70, 74, 79, 82, 85, 89, 94, 98, 113, 114, 118 };  
            for (int i = 0; i < 19; i++)  
            {  
                she_shouNum[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(19);  
            t = she_shouNum[c];  
            imageList1.ImageSize = new Size(120, 120);  
            pictureBox1.Image = imageList1.Images[t];  
            sumHeroPhoto[t]++;  
            this.label3.Text = sumHeroPhoto[t].ToString();  
        }  
  
        
        void getZhan_shi()  
        {  
            
            int[] s = new int[] {2,15,17,19,25,30,34,38,40,42,43,44,  
                                    47,48,49,53,54,58,60,61,62,68,71,72,  
                                        77,83,88,90,92,97,100,101,106,119,120,124};  
            for (int i = 0; i < 36; i++)  
            {  
                zhan_shiNum[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(36);  
            t = zhan_shiNum[c];  
            imageList1.ImageSize = new Size(120, 120);  
            pictureBox1.Image = imageList1.Images[t];  
            sumHeroPhoto[t]++;  
            this.label3.Text = sumHeroPhoto[t].ToString();  
        }  
  
        
        void getFa_shi()  
        {  
            
            int[] s = new int[] {0,7,8,9,11,14,21,23,28,32,36,41,  
                                    45,46,50,51,57,63,64,76,93,95,103,105,  
                                        110,111,117,122};  
            for (int i = 0; i < 28; i++)  
            {  
                fa_shiNum[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(28);  
            t = fa_shiNum[c];  
            imageList1.ImageSize = new Size(120, 120);  
            pictureBox1.Image = imageList1.Images[t];  
            sumHeroPhoto[t]++;  
            this.label3.Text = sumHeroPhoto[t].ToString();  
        }  
  
        
        void getFu_zhu()  
        {  
          
            int[] s = new int[] { 5, 26, 27, 37, 39, 73, 86, 102, 104, 112, 123 };  
            for (int i = 0; i < 11; i++)  
            {  
                fu_zhuNum[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(11);  
            t = fu_zhuNum[c];  
            imageList1.ImageSize = new Size(120, 120);  
            pictureBox1.Image = imageList1.Images[t];  
            sumHeroPhoto[t]++;  
            this.label3.Text = sumHeroPhoto[t].ToString();  
        }  
  
       
        void messageRecord()  
        {  
           
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "125".ToString();    
  
            for (int i = 0; i < 125; i++)  
            {  
                 
                if (sumHeroPhoto[i] != 0)  
                {  
                    m0++;  
                }  
               
                if (percent[i] >= 0.6 && percent[i] < 0.7)  
                {  
                    m1++;  
                }  
               
                if (percent[i] >= 0.7 && percent[i] < 0.8)  
                {  
                    m2++;  
                }  
              
                if (percent[i] >= 0.8 && percent[i] < 0.9)  
                {  
                    m3++;  
                }  
                
                if (percent[i] >= 0.9 && percent[i] < 0.99)  
                {  
                    m4++;  
                }  
              
                if (percent[i] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();  
        }  
  
       
        void ci_keMessage()  
        {  
            /  
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "15".ToString();       
  
            for (int i = 0; i < 15; i++)  
            {  
                
                if (sumHeroPhoto[ci_keNum[i]] != 0)  
                {  
                    m0++;  
                }  
                
                if (percent[ci_keNum[i]] >= 0.6 && percent[ci_keNum[i]] < 0.7)  
                {  
                    m1++;  
                }  
               
                if (percent[ci_keNum[i]] >= 0.7 && percent[ci_keNum[i]] < 0.8)  
                {  
                    m2++;  
                }  
               
                if (percent[ci_keNum[i]] >= 0.8 && percent[ci_keNum[i]] < 0.9)  
                {  
                    m3++;  
                }  
                 
                if (percent[ci_keNum[i]] >= 0.9 && percent[ci_keNum[i]] < 0.99)  
                {  
                    m4++;  
                }  
                
                if (percent[ci_keNum[i]] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();  
        }  
 
        void tan_keMessage()  
        {  
         
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "16".ToString();    
  
            for (int i = 0; i < 16; i++)  
            {  
                
                if (sumHeroPhoto[tan_keNum[i]] != 0)  
                {  
                    m0++;  
                }  
                
                if (percent[tan_keNum[i]] >= 0.6 && percent[tan_keNum[i]] < 0.7)  
                {  
                    m1++;  
                }  
               
                if (percent[tan_keNum[i]] >= 0.7 && percent[tan_keNum[i]] < 0.8)  
                {  
                    m2++;  
                }  
              
                if (percent[tan_keNum[i]] >= 0.8 && percent[tan_keNum[i]] < 0.9)  
                {  
                    m3++;  
                }  
             
                if (percent[tan_keNum[i]] >= 0.9 && percent[tan_keNum[i]] < 0.99)  
                {  
                    m4++;  
                }  
              
                if (percent[tan_keNum[i]] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();   
        }  
  
        
        void she_shouMessage()  
        {  
             
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "19".ToString();       
  
            for (int i = 0; i < 19; i++)  
            {  
                
                if (sumHeroPhoto[she_shouNum[i]] != 0)  
                {  
                    m0++;  
                }  
               
                if (percent[she_shouNum[i]] >= 0.6 && percent[she_shouNum[i]] < 0.7)  
                {  
                    m1++;  
                }  
                
                if (percent[she_shouNum[i]] >= 0.7 && percent[she_shouNum[i]] < 0.8)  
                {  
                    m2++;  
                }  
               
                if (percent[she_shouNum[i]] >= 0.8 && percent[she_shouNum[i]] < 0.9)  
                {  
                    m3++;  
                }  
                
                if (percent[she_shouNum[i]] >= 0.9 && percent[she_shouNum[i]] < 0.99)  
                {  
                    m4++;  
                }  
             
                if (percent[she_shouNum[i]] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();   
        }  
  
    
        void zhan_shiMessage()  
        {  
           
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "36".ToString();       
  
            for (int i = 0; i < 36; i++)  
            {  
                
                if (sumHeroPhoto[zhan_shiNum[i]] != 0)  
                {  
                    m0++;  
                }  
       
                if (percent[zhan_shiNum[i]] >= 0.6 && percent[zhan_shiNum[i]] < 0.7)  
                {  
                    m1++;  
                }  
                
                if (percent[zhan_shiNum[i]] >= 0.7 && percent[zhan_shiNum[i]] < 0.8)  
                {  
                    m2++;  
                }  
                
                if (percent[zhan_shiNum[i]] >= 0.8 && percent[zhan_shiNum[i]] < 0.9)  
                {  
                    m3++;  
                }  
               
                if (percent[zhan_shiNum[i]] >= 0.9 && percent[zhan_shiNum[i]] < 0.99)  
                {  
                    m4++;  
                }  
                
                if (percent[zhan_shiNum[i]] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();   
        }  
  
        
        void fa_shiMessage()  
        {  
           
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "28".ToString();      
  
            for (int i = 0; i < 28; i++)  
            {  
              
                if (sumHeroPhoto[fa_shiNum[i]] != 0)  
                {  
                    m0++;  
                }  
                // 较熟悉  
                if (percent[fa_shiNum[i]] >= 0.6 && percent[fa_shiNum[i]] < 0.7)  
                {  
                    m1++;  
                }  
                
                if (percent[fa_shiNum[i]] >= 0.7 && percent[fa_shiNum[i]] < 0.8)  
                {  
                    m2++;  
                }  
          
                if (percent[fa_shiNum[i]] >= 0.8 && percent[fa_shiNum[i]] < 0.9)  
                {  
                    m3++;  
                }  
               
                if (percent[fa_shiNum[i]] >= 0.9 && percent[fa_shiNum[i]] < 0.99)  
                {  
                    m4++;  
                }  
           
                if (percent[fa_shiNum[i]] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();   
        }  
  
        
        void fu_zhuMessage()  
        {  
            // 清空数据  
            m0 = 0;  
            m1 = 0;  
            m2 = 0;  
            m3 = 0;  
            m4 = 0;  
            m5 = 0;  
  
            label13.Text = "11".ToString();      
  
            for (int i = 0; i < 11; i++)  
            {  
             
                if (sumHeroPhoto[fu_zhuNum[i]] != 0)  
                {  
                    m0++;  
                }  
             
                if (percent[fu_zhuNum[i]] >= 0.6 && percent[fu_zhuNum[i]] < 0.7)  
                {  
                    m1++;  
                }  
               
                if (percent[fu_zhuNum[i]] >= 0.7 && percent[fu_zhuNum[i]] < 0.8)  
                {  
                    m2++;  
                }  
                
                if (percent[fu_zhuNum[i]] >= 0.8 && percent[fu_zhuNum[i]] < 0.9)  
                {  
                    m3++;  
                }  
                 
                if (percent[fu_zhuNum[i]] >= 0.9 && percent[fu_zhuNum[i]] < 0.99)  
                {  
                    m4++;  
                }  
               
                if (percent[fu_zhuNum[i]] >= 0.99)  
                {  
                    m5++;  
                }  
            }  
            label14.Text = m0.ToString();  
            label15.Text = m1.ToString();  
            label16.Text = m2.ToString();  
            label17.Text = m3.ToString();  
            label18.Text = m4.ToString();  
            label19.Text = m5.ToString();   
        }  
  
    
        private void exitGame_Click(object sender, EventArgs e)  
        {  
            
            String con = (@"server=LONG-PC\LONG;database=caicaikan;user id=sa;password=123456");  
            SqlConnection conn = new SqlConnection(con);  
          
            StringBuilder sqlstr = new StringBuilder();  
            conn.Open();  
  
            if (model == 1)  
            {  
           
                SqlCommand sc = new SqlCommand();  
                sc.CommandText = ("truncate table modelOne");  
                sc.Connection = conn;  
                sc.ExecuteNonQuery();  
                for (int i = 0; i < 125; i++)  
                {  
                    sqlstr.Append("insert into modelOne(sumHeroPhoto,trueGuessNum,[percent],tp)");  
                    sqlstr.Append("values");  
                    sqlstr.Append("('" + sumHeroPhoto[i] + "','" + trueGuessNum[i] + "','" + percent[i] + "','" + tp[i] + "')");  
  
                    using (SqlCommand cmd = new SqlCommand(sqlstr.ToString(), conn)) //定义连接命令  
                    {  
                        //cmd.CommandType = CommandType.StoredProcedure;                    
                        cmd.ExecuteNonQuery();//执行sql语句        
                    }  
  
                    sqlstr.Clear();  
                }  
            }  
            else  
            {  
                
                SqlCommand sc2 = new SqlCommand();  
                sc2.CommandText = ("truncate table modelTwo");  
                sc2.Connection = conn;  
                sc2.ExecuteNonQuery();  
                for (int i = 0; i < 125; i++)  
                {  
                    sqlstr.Append("insert into modelTwo(modelTwoName,trueGuessPhoto,percent2,tp2)");  
                    sqlstr.Append("values");  
                    sqlstr.Append("('" + modelTwoName[i] + "','" + trueGuessPhoto[i] + "','" + percent2[i] + "','" + tp2[i] + "')");  
  
                    using (SqlCommand cmd2 = new SqlCommand(sqlstr.ToString(), conn)) 
                        //cmd.CommandType = CommandType.StoredProcedure;                    
                        cmd2.ExecuteNonQuery();     
                    }  
  
                    sqlstr.Clear();  
                }  
            }  
            conn.Close();  
            conn.Dispose();  
            this.Close();  
        }  
  
   
        private void correctResult_Click(object sender, EventArgs e)  
        {  
            if (model == 1)  
            {  
                if (num[x1] == t)  
                    radioButton1.Checked = true;  
                if (num[x2] == t)  
                    radioButton2.Checked = true;  
                if (num[x3] == t)  
                    radioButton3.Checked = true;  
                textBox1.Text = "该英雄的名字为:";  
            }  
            else  
            {  
                if (num2[x1] == t2)  
                {                      
                  
                    Graphics g = Graphics.FromHwnd(this.pictureBox2.Handle);  
                    PaintEventArgs a = new PaintEventArgs(g, this.pictureBox2.ClientRectangle);  
                    this.pictureBox2_Paint(this.pictureBox2, a);  
                    g.Dispose();  
                    
                    delay(100);  
                    pictureBox2.Image = imageList1.Images[num2[x1]];  
                }  
  
                if (num2[x2] == t2)  
                {  
                    
                    Graphics g = Graphics.FromHwnd(this.pictureBox3.Handle);  
                    PaintEventArgs a = new PaintEventArgs(g, this.pictureBox3.ClientRectangle);  
                    this.pictureBox3_Paint(this.pictureBox3, a);  
                    g.Dispose();  
  
                    delay(100);  
                    pictureBox3.Image = imageList1.Images[num2[x2]];  
                      
                }  
  
                if (num2[x3] == t2)  
                {  
                    Graphics g = Graphics.FromHwnd(this.pictureBox4.Handle);  
                    PaintEventArgs a = new PaintEventArgs(g, this.pictureBox4.ClientRectangle);  
                    this.pictureBox4_Paint(this.pictureBox4, a);  
                    g.Dispose();  
  
                    delay(100);  
                    pictureBox4.Image = imageList1.Images[num2[x3]];  
                }  
                textBox1.Text = "该英雄的头像为:";  
            }  
        }  
  
        // 晒选英雄类型按钮  
        private void scc_Click(object sender, EventArgs e)  
        {  
            continueGame.Visible = false;  
            correctResult.Visible = false;  
            this.textBox1.Text = "请选择答案";  
            re_elect = false;  
            this.label4.Text = "选择答案查看";  
  
            //筛选  
            if (model == 1)  
            {  
                switch (comboBox1.SelectedIndex)  
                {  
                    case 0:  
                        randomHero();  
                        getThreeChecked();  
                        cleanRadio123();  
                        messageRecord();  
                        break;  
  
                    case 1:  
                        getCi_ke();  
                        getThreeChecked();  
                        cleanRadio123();  
                        ci_keMessage();  
                        break;  
  
                    case 2:  
                        getTan_ke();  
                        getThreeChecked();  
                        cleanRadio123();  
                        tan_keMessage();  
                        break;  
  
                    case 3:  
                        getShe_shou();  
                        getThreeChecked();  
                        cleanRadio123();  
                        she_shouMessage();  
                        break;  
  
                    case 4:  
                        getZhan_shi();  
                        getThreeChecked();  
                        cleanRadio123();  
                        zhan_shiMessage();  
                        break;  
  
                    case 5:  
                        getFa_shi();  
                        getThreeChecked();  
                        cleanRadio123();  
                        fa_shiMessage();  
                        break;  
  
                    case 6:  
                        getFu_zhu();  
                        getThreeChecked();  
                        cleanRadio123();  
                        fu_zhuMessage();  
                        break;  
                }  
            }  
            else  
            {  
                switch (comboBox1.SelectedIndex)  
                {  
                    case 0:  
                        getName();                                  // 获得随机名字  
                        getThreeChecked2();                         // 获得3个选项  
                        messageRecord2();  
                        break;  
  
                    case 1:  
                        getCi_ke2();  
                        getThreeChecked2();                         // 获得3个选项  
                        ci_keMessage2();  
                        break;  
  
                    case 2:  
                        getTan_ke2();  
                        getThreeChecked2();  
                        tan_keMessage2();  
                        break;  
  
                    case 3:  
                        getShe_shou2();  
                        getThreeChecked2();  
                        she_shouMessage2();  
                        break;  
  
                    case 4:  
                        getZhan_shi2();  
                        getThreeChecked2();  
                        zhan_shiMessage2();  
                        break;  
  
                    case 5:  
                        getFa_shi2();  
                        getThreeChecked2();  
                        fa_shiMessage2();  
                        break;  
  
                    case 6:  
                        getFu_zhu2();  
                        getThreeChecked2();  
                        fu_zhuMessage2();  
                        break;  
                }  
            }  
        }  
  

         
    
        private void moderTwo_Click(object sender, EventArgs e)  
        {  
            model = 2;  
            // 连接数据库  
            String con = (@"server=LONG-PC\LONG;database=caicaikan;user id=sa;password=123456");  
            SqlConnection conn = new SqlConnection(con);  
            // 读取数据库数据  
            conn.Open();  
            SqlCommand cmd = new SqlCommand();  
            cmd.CommandText = "select * from modelTwo";  
            cmd.Connection = conn;  
            SqlDataAdapter da = new SqlDataAdapter(cmd);  
            DataSet ds = new DataSet();  
            da.Fill(ds);  
            DataTable dt = new DataTable();  
            dt = ds.Tables[0].Copy();  
            double[] a = new double[125];  
            for (int i = 0; i < 125; i++)  
            {  
                modelTwoName[i] = (int)dt.Rows[i].ItemArray[0];  
                trueGuessPhoto[i] = (int)dt.Rows[i].ItemArray[1];  
  
                // 先将数据库中的float转换为c#中的double  
                a[i] = (double)dt.Rows[i].ItemArray[2];  
                percent2[i] = (float)a[i];  
  
                tp2[i] = (int)dt.Rows[i].ItemArray[3];  
            }  
            conn.Close();  
            conn.Dispose();                 
  
              
            modelTwoVisible(true);  
            pictureBox1.Visible = false;  
            radioButton1.Visible = false;  
            radioButton2.Visible = false;  
            radioButton3.Visible = false;           
  
              
            getName();                                  // 获得随机名字  
            getThreeChecked2();                         // 获得3个选项  
            this.textBox1.Text = "请选择答案";  
            re_elect = false;                           // 默认没有重选  
            label4.Text = "选择答案查看";  
            messageRecord2();                           // 显示模式二进度  
  
        }  
  
       
        void modelTwoVisible(bool mv)  
        {  
            if (mv == true)  
            {  
                pictureBox2.Visible = true;  
                pictureBox3.Visible = true;  
                pictureBox4.Visible = true;                                
                textBox1.Visible = true;  
                continueGame.Visible = false;  
                correctResult.Visible = false;  
                label1.Visible = true;  
                label2.Visible = true;  
                label3.Visible = true;  
                label4.Visible = true;  
                label6.Visible = true;  
                label7.Visible = true;  
                label8.Visible = true;  
                label9.Visible = true;  
                label10.Visible = true;  
                label11.Visible = true;  
                label12.Visible = true;  
                label13.Visible = true;  
                label14.Visible = true;  
                label15.Visible = true;  
                label16.Visible = true;  
                label17.Visible = true;  
                label18.Visible = true;  
                label19.Visible = true;  
                aRandomName.Visible = true;  
            }  
            else  
            {  
                pictureBox2.Visible = false;  
                pictureBox3.Visible = false;  
                pictureBox4.Visible = false;  
                textBox1.Visible = false;  
                continueGame.Visible = false;  
                correctResult.Visible = false;  
                label1.Visible = false;  
                label2.Visible = false;  
                label3.Visible = false;  
                label4.Visible = false;  
                label6.Visible = false;  
                label7.Visible = false;  
                label8.Visible = false;  
                label9.Visible = false;  
                label10.Visible = false;  
                label11.Visible = false;  
                label12.Visible = false;  
                label13.Visible = false;  
                label14.Visible = false;  
                label15.Visible = false;  
                label16.Visible = false;  
                label17.Visible = false;  
                label18.Visible = false;  
                label19.Visible = false;  
                aRandomName.Visible = false;  
            }  
        }  
  
         
        void getName()  
        {  
            bool boo = new bool();  
            boo = true;  
            Random ran = new Random();  
            t2 = ran.Next(125);  
            while (t2 == p1 || t2 == p2)  
            {  
                t2 = ran.Next(125);  
            }           
            
            while (boo)  
            {  
                if (percent2[t2] >= 0.6)  
                {  
                    
                    if (percent2[t2] >= 0.99)  
                    {  
                        n5++;  
                        if (tp2[t2] == 9)  
                        {  
                            pictureBox1.Image = imageList1.Images[t2];  
                            sumHeroPhoto[t2]++;  
                            this.label3.Text = sumHeroPhoto[t2].ToString();  
                            tp2[t2] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp2[t2]++;  
                            t2 = ran.Next(125);  
                        }  
                    }  
                    // 英雄认识率在90%到99%之间,出现的概率为原来的1/5  
                    if (percent2[t2] >= 0.9 && percent2[t2] < 0.99)  
                    {  
                        n4++;  
                        if (tp2[t2] == 4)  
                        {  
                            pictureBox1.Image = imageList1.Images[t2];  
                            sumHeroPhoto[t2]++;  
                            this.label3.Text = sumHeroPhoto[t2].ToString();  
                            tp2[t2] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp2[t2]++;  
                            t2 = ran.Next(125);  
                        }  
                    }  
                    // 英雄认识率在80%到90%之间,出现的概率为原来的1/4  
                    if (percent2[t2] >= 0.8 && percent2[t2] < 0.9)  
                    {  
                        n3++;  
                        if (tp2[t2] == 3)  
                        {  
                            pictureBox1.Image = imageList1.Images[t2];  
                            sumHeroPhoto[t2]++;  
                            this.label3.Text = sumHeroPhoto[t2].ToString();  
                            tp2[t2] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp2[t2]++;  
                            t2 = ran.Next(125);  
                        }  
                    }  
                   
                    if (percent2[t2] >= 0.7 && percent2[t2] < 0.8)  
                    {  
                        n2++;  
                        if (tp2[t2] == 2)  
                        {  
                            pictureBox1.Image = imageList1.Images[t2];  
                            sumHeroPhoto[t2]++;  
                            this.label3.Text = sumHeroPhoto[t2].ToString();  
                            tp2[t2] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp2[t2]++;  
                            t2 = ran.Next(125);  
                        }  
                    }  
                  
                    if (percent2[t2] >= 0.6 && percent2[t2] < 0.7)  
                    {  
                        n1++;  
                        if (tp2[t2] == 1)  
                        {  
                            pictureBox1.Image = imageList1.Images[t2];  
                            sumHeroPhoto[t2]++;  
                            this.label3.Text = sumHeroPhoto[t2].ToString();  
                            tp2[t2] = 0;  
                            boo = false;  
                        }  
                        else  
                        {  
                            tp2[t2]++;  
                            t2 = ran.Next(125);  
                        }  
                    }  
                }  
          
                else  
                {  
                    aRandomName.Text=sumHeroNames[t2].ToString();  
                    modelTwoName[t2]++;  
                    boo = false;  
                }  
            }  
            this.label3.Text = modelTwoName[t2].ToString();  
        }  
  
       
        int randomPhoto1()   
        {  
            Random ran = new Random();  
            p1 = ran.Next(125);  
            while (p1 == p2 || p1 == t2)  
            {  
                p1 = ran.Next(125);  
            }  
            return p1;  
        }  
  
     
        int randomPhoto2()  
        {  
            Random ran = new Random();  
            p2 = ran.Next(125);  
            while (p2 == p1 || p2 == t2)  
            {  
                p2 = ran.Next(125);  
            }  
            return p2;  
        }  
  
    
        void getThreeChecked2()  
        {  
            Random rn = new Random();  
            int p = randomPhoto1();  
            int q = randomPhoto2();  
  
            num2[0] = t2;  
            num2[1] = p;  
            num2[2] = q;  
  
            
            x1 = rn.Next(3);  
            pictureBox2.Image = imageList1.Images[num2[x1]];  
  
           
            x2 = rn.Next(3);  
            while (x2 == x1)     
            {  
                x2 = rn.Next(3);  
            }  
            pictureBox3.Image = imageList1.Images[num2[x2]];  
  
            // 生成第三个选项  
            x3 = rn.Next(3);  
            while (x3 == x1 || x3 == x2)       
            {  
                x3 = rn.Next(3);  
            }  
            pictureBox4.Image = imageList1.Images[num2[x3]];  
        }  
  
     
        private void pictureBox2_Click(object sender, EventArgs e)  
        {  
  
            Graphics g = Graphics.FromHwnd(this.pictureBox2.Handle);  
            PaintEventArgs a = new PaintEventArgs(g, this.pictureBox2.ClientRectangle);  
            this.pictureBox2_Paint(this.pictureBox2, a);  
            g.Dispose();  
  
            delay(100);  
            pictureBox2.Image = imageList1.Images[num2[x1]];  
  
  
            
            if (re_elect == true)   
            {  
                textBox1.Text = "只能选择一次";  
            }  
            else  
            {  
                if (num2[x1] == t2)  
                {  
                    textBox1.Text = "正确";  
                    trueGuessPhoto[num2[x1]]++;  
                }  
                else  
                {  
                    textBox1.Text = "错误";  
                }  
            }  
            continueGame.Visible = true;     
            correctResult.Visible = true;  
            re_elect = true;                
            
            percent2[t2] = (float)trueGuessPhoto[t2] / (modelTwoName[t2] + 2);  
            label4.Text = percent2[t2].ToString("0.00%");                     
        }  
  
       
        private void pictureBox3_Click(object sender, EventArgs e)  
        {  
            Graphics g = Graphics.FromHwnd(this.pictureBox3.Handle);  
            PaintEventArgs a = new PaintEventArgs(g, this.pictureBox3.ClientRectangle);  
            this.pictureBox3_Paint(this.pictureBox3, a);  
            g.Dispose();  
  
            delay(100);  
            pictureBox3.Image = imageList1.Images[num2[x2]];  
  
            // 实现模式一选择答案功能  
            if (re_elect == true)  
            {  
                textBox1.Text = "只能选择一次";  
            }  
            else  
            {  
                if (num2[x2] == t2)  
                {  
                    textBox1.Text = "正确";  
                    trueGuessPhoto[num2[x2]]++;  
                }  
                else  
                {  
                    textBox1.Text = "错误";  
                }  
            }  
  
            continueGame.Visible = true;  
            correctResult.Visible = true;  
            re_elect = true;  
  
            //计算认识率  
            percent2[t2] = (float)(trueGuessPhoto[t2]) / (modelTwoName[t2] + 2);  
            label4.Text = percent2[t2].ToString("0.00%");            
        }  
  
        // 点击第三张图片触发事件  
        private void pictureBox4_Click(object sender, EventArgs e)  
        {  
            Graphics g = Graphics.FromHwnd(this.pictureBox4.Handle);  
            PaintEventArgs a = new PaintEventArgs(g, this.pictureBox4.ClientRectangle);  
            this.pictureBox4_Paint(this.pictureBox4, a);  
            g.Dispose();  
  
            delay(100);  
            pictureBox4.Image = imageList1.Images[num2[x3]];  
  
            // 实现模式一选择答案功能  
            if (re_elect == true)  
            {  
                textBox1.Text = "只能选择一次";  
            }  
            else  
            {  
                if (num2[x3] == t2)  
                {  
                    textBox1.Text = "正确";  
                    trueGuessPhoto[num2[x3]]++;  
                }  
                else  
                {  
                    textBox1.Text = "错误";  
                }  
            }  
  
            continueGame.Visible = true;  
            correctResult.Visible = true;  
            re_elect = true;  
            //计算认识率  
            percent2[t2] = (float)trueGuessPhoto[t2] / (modelTwoName[t2] + 2);  
            label4.Text = percent2[t2].ToString("0.00%");  
        }  
  
  
        // 第一张图片 
        private void pictureBox2_Paint(object sender, PaintEventArgs e)  
        {  
            PictureBox p = (PictureBox)sender;  
            Pen pp = new Pen(Color.Khaki);  
            e.Graphics.DrawRectangle(pp, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.X + e.ClipRectangle.Width - 1, e.ClipRectangle.Y + e.ClipRectangle.Height - 1);  
        }  
  
        // 第二张图片  
        private void pictureBox3_Paint(object sender, PaintEventArgs e)  
        {  
            PictureBox p = (PictureBox)sender;  
            Pen pp = new Pen(Color.Khaki);  
            e.Graphics.DrawRectangle(pp, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.X + e.ClipRectangle.Width - 1, e.ClipRectangle.Y + e.ClipRectangle.Height - 1);  
        }  
  
        // 第三张图片
        private void pictureBox4_Paint(object sender, PaintEventArgs e)  
        {  
            PictureBox p = (PictureBox)sender;  
            Pen pp = new Pen(Color.Khaki);  
            e.Graphics.DrawRectangle(pp, e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.X + e.ClipRectangle.Width - 1, e.ClipRectangle.Y + e.ClipRectangle.Height - 1);  
        }  
  
        // 全部信息记录  
        void messageRecord2()  
        {  
            // 清空数据  
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "125".ToString();      
  
            for (int i = 0; i < 125; i++)  
            {  
                 
                if (trueGuessPhoto[i] != 0)  
                {  
                    n0++;  
                }  
            
                if (percent2[i] >= 0.6 && percent2[i] < 0.7)  
                {  
                    n1++;  
                }  
               
                if (percent2[i] >= 0.7 && percent2[i] < 0.8)  
                {  
                    n2++;  
                }  
             
                if (percent2[i] >= 0.8 && percent2[i] < 0.9)  
                {  
                    n3++;  
                }  
              
                if (percent2[i] >= 0.9 && percent2[i] < 0.99)  
                {  
                    n4++;  
                }  
            
                if (percent2[i] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
        // 获取随机刺数据
        void getCi_ke2()  
        {  
            
            int[] s = new int[] { 3, 4, 10, 12, 16, 22, 31, 33, 52, 87, 99, 107, 109, 115, 116 };  
            for (int i = 0; i < 15; i++)  
            {  
                ci_keNum2[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(15);  
            t2 = ci_keNum2[c];  
            aRandomName.Text=sumHeroNames[t2];  
            modelTwoName[t2]++;  
            this.label3.Text =  modelTwoName[t2].ToString();  
  
        }  
  
        // 获取随机数据
        void getTan_ke2()  
        {  
             
            int[] s = new int[] { 18, 55, 56, 65, 66, 67, 69, 75, 78, 80, 81, 84, 91, 96, 108, 121 };  
            for (int i = 0; i < 16; i++)  
            {  
                tan_keNum2[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(16);  
            t2 = tan_keNum2[c];  
            aRandomName.Text = sumHeroNames[t2];  
            modelTwoName[t2]++;  
            this.label3.Text = modelTwoName[t2].ToString();  
        }  
  
        // 获取随机数据  
        void getShe_shou2()  
        {  
           
            int[] s = new int[] { 1, 6, 13, 20, 24, 29, 35, 59, 70, 74, 79, 82, 85, 89, 94, 98, 113, 114, 118 };  
            for (int i = 0; i < 19; i++)  
            {  
                she_shouNum2[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(19);  
            t2 = she_shouNum2[c];  
            aRandomName.Text = sumHeroNames[t2];  
            modelTwoName[t2]++;  
            this.label3.Text = modelTwoName[t2].ToString();  
        }  
  
        // 获取随机数据 
        void getZhan_shi2()  
        {  
              
          int[] s = new int[] {2,15,17,19,25,30,34,38,40,42,43,44,  
                                    47,48,49,53,54,58,60,61,62,68,71,72,  
                                        77,83,88,90,92,97,100,101,106,119,120,124};  
            for (int i = 0; i < 36; i++)  
            {  
                zhan_shiNum2[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(36);  
            t2 = zhan_shiNum2[c];  
            aRandomName.Text = sumHeroNames[t2];  
            modelTwoName[t2]++;  
            this.label3.Text = modelTwoName[t2].ToString();  
        }  
  
        // 获取随机数据
        void getFa_shi2()  
        {  
            
            int[] s = new int[] {0,7,8,9,11,14,21,23,28,32,36,41,  
                                    45,46,50,51,57,63,64,76,93,95,103,105,  
                                        110,111,117,122};  
            for (int i = 0; i < 28; i++)  
            {  
                fa_shiNum2[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(28);  
            t2 = fa_shiNum2[c];  
            aRandomName.Text = sumHeroNames[t2];  
            modelTwoName[t2]++;  
            this.label3.Text = modelTwoName[t2].ToString();  
        }  
  
        // 获取随机数据
        void getFu_zhu2()  
        {  
            // 获取随机数据
            int[] s = new int[] { 5, 26, 27, 37, 39, 73, 86, 102, 104, 112, 123 };  
            for (int i = 0; i < 11; i++)  
            {  
                fu_zhuNum2[i] = s[i];  
            }  
            int c = new int();  
            Random ran = new Random();  
            c = ran.Next(11);  
            t2 = fu_zhuNum2[c];  
            aRandomName.Text = sumHeroNames[t2];  
            modelTwoName[t2]++;  
            this.label3.Text = modelTwoName[t2].ToString();  
        }  
  
         
        void ci_keMessage2()  
        {  
            
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "15".ToString();      
  
            for (int i = 0; i < 15; i++)  
            {  
                
                if (modelTwoName[ci_keNum2[i]] != 0)  
                {  
                    n0++;  
                }  
                
                if (percent2[ci_keNum2[i]] >= 0.6 && percent2[ci_keNum2[i]] < 0.7)  
                {  
                    n1++;  
                }  
                // 已认识  
                if (percent2[ci_keNum2[i]] >= 0.7 && percent2[ci_keNum2[i]] < 0.8)  
                {  
                    n2++;  
                }  
               
                if (percent2[ci_keNum2[i]] >= 0.8 && percent2[ci_keNum2[i]] < 0.9)  
                {  
                    n3++;  
                }  
              
                if (percent2[ci_keNum2[i]] >= 0.9 && percent2[ci_keNum2[i]] < 0.99)  
                {  
                    n4++;  
                }  
                 
                if (percent2[ci_keNum2[i]] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
         
        void tan_keMessage2()  
        {  
            
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "16".ToString();     
  
            for (int i = 0; i < 16; i++)  
            {  
                 
                if (modelTwoName[tan_keNum2[i]] != 0)  
                {  
                    n0++;  
                }  
                
                if (percent2[tan_keNum2[i]] >= 0.6 && percent2[tan_keNum2[i]] < 0.7)  
                {  
                    n1++;  
                }  
                
                if (percent2[tan_keNum2[i]] >= 0.7 && percent2[tan_keNum2[i]] < 0.8)  
                {  
                    n2++;  
                }  
               
                if (percent2[tan_keNum2[i]] >= 0.8 && percent2[tan_keNum2[i]] < 0.9)  
                {  
                    n3++;  
                }  
                
                if (percent2[tan_keNum2[i]] >= 0.9 && percent2[tan_keNum2[i]] < 0.99)  
                {  
                    n4++;  
                }  
                // 一眼辨认  
                if (percent2[tan_keNum2[i]] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
          
        void she_shouMessage2()  
        {  
         
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "19".ToString();     
  
            for (int i = 0; i < 19; i++)  
            {  
             
                if (modelTwoName[she_shouNum2[i]] != 0)  
                {  
                    n0++;  
                }  
                
                if (percent2[she_shouNum2[i]] >= 0.6 && percent2[she_shouNum2[i]] < 0.7)  
                {  
                    n1++;  
                }  
                
                if (percent2[she_shouNum2[i]] >= 0.7 && percent2[she_shouNum2[i]] < 0.8)  
                {  
                    n2++;  
                }  
                
                if (percent2[she_shouNum2[i]] >= 0.8 && percent2[she_shouNum2[i]] < 0.9)  
                {  
                    n3++;  
                }  
               
                if (percent2[she_shouNum2[i]] >= 0.9 && percent2[she_shouNum2[i]] < 0.99)  
                {  
                    n4++;  
                }  
                
                if (percent2[she_shouNum2[i]] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
     
        void zhan_shiMessage2()  
        {  
            
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "36".ToString();      
  
            for (int i = 0; i < 36; i++)  
            {  
                // 初认识  
                if (modelTwoName[zhan_shiNum2[i]] != 0)  
                {  
                    n0++;  
                }  
                // 较熟悉  
                if (percent2[zhan_shiNum2[i]] >= 0.6 && percent2[zhan_shiNum2[i]] < 0.7)  
                {  
                    n1++;  
                }  
                // 已认识  
                if (percent2[zhan_shiNum2[i]] >= 0.7 && percent2[zhan_shiNum2[i]] < 0.8)  
                {  
                    n2++;  
                }  
                // 很熟悉  
                if (percent2[zhan_shiNum2[i]] >= 0.8 && percent2[zhan_shiNum2[i]] < 0.9)  
                {  
                    n3++;  
                }  
              
                if (percent2[zhan_shiNum2[i]] >= 0.9 && percent2[zhan_shiNum2[i]] < 0.99)  
                {  
                    n4++;  
                }  
                
                if (percent2[zhan_shiNum2[i]] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
      
        void fa_shiMessage2()  
        {  
           
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "28".ToString();      
  
            for (int i = 0; i < 28; i++)  
            {  
              
                if (modelTwoName[fa_shiNum2[i]] != 0)  
                {  
                    n0++;  
                }  
                
                if (percent2[fa_shiNum2[i]] >= 0.6 && percent2[fa_shiNum2[i]] < 0.7)  
                {  
                    n1++;  
                }  
               
                if (percent2[fa_shiNum2[i]] >= 0.7 && percent2[fa_shiNum2[i]] < 0.8)  
                {  
                    n2++;  
                }  
               
                if (percent2[fa_shiNum2[i]] >= 0.8 && percent2[fa_shiNum2[i]] < 0.9)  
                {  
                    n3++;  
                }  
                
                if (percent2[fa_shiNum2[i]] >= 0.9 && percent2[fa_shiNum2[i]] < 0.99)  
                {  
                    n4++;  
                }  
              
                if (percent2[fa_shiNum2[i]] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
        /
        void fu_zhuMessage2()  
        {  
            
            n0 = 0;  
            n1 = 0;  
            n2 = 0;  
            n3 = 0;  
            n4 = 0;  
            n5 = 0;  
  
            label13.Text = "11".ToString();      
  
            for (int i = 0; i < 11; i++)  
            {  
             
                if (modelTwoName[fu_zhuNum2[i]] != 0)  
                {  
                    n0++;  
                }  
               
                if (percent2[fu_zhuNum2[i]] >= 0.6 && percent2[fu_zhuNum2[i]] < 0.7)  
                {  
                    n1++;  
                }  
               
                if (percent2[fu_zhuNum2[i]] >= 0.7 && percent2[fu_zhuNum2[i]] < 0.8)  
                {  
                    n2++;  
                }  
            
                if (percent2[fu_zhuNum2[i]] >= 0.8 && percent2[fu_zhuNum2[i]] < 0.9)  
                {  
                    n3++;  
                }  
                
                if (percent2[fu_zhuNum2[i]] >= 0.9 && percent2[fu_zhuNum2[i]] < 0.99)  
                {  
                    n4++;  
                }  
               
                if (percent2[fu_zhuNum2[i]] >= 0.99)  
                {  
                    n5++;  
                }  
            }  
            label14.Text = n0.ToString();  
            label15.Text = n1.ToString();  
            label16.Text = n2.ToString();  
            label17.Text = n3.ToString();  
            label18.Text = n4.ToString();  
            label19.Text = n5.ToString();  
        }  
  
        // 延时函数  
        private void delay(int iInterval)  
        {  
            DateTime now = DateTime.Now;  
            while (now.AddMilliseconds(iInterval) > DateTime.Now)  
            {  
            }  
            return;  
        }  
    }  
}  

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1675次
    • 积分:110
    • 等级:
    • 排名:千里之外
    • 原创:9篇
    • 转载:0篇
    • 译文:0篇
    • 评论:5条
    文章分类
    最新评论