Exemple #1
0
 private void richPictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left && this.canPlay)
     {
         Point p = GetMousePoint(e.X, e.Y);
         this.Reword(p, true);
         if (Explore.Test(this.table))
         {
             new SoundPlayer(@"music\win.wav").Play();
             MessageBox.Show("恭喜!\r\n玩家获胜!", "温馨提示");
             this.canPlay = false;
             return;
         }
         if (this.computerFirst)
         {
             this.foot += 1;
         }
         p = Explore.FindOptimalPoint(this.table);
         this.Reword(p, false);
         if (Explore.Test(this.table))
         {
             new SoundPlayer(@"music\fail.wav").Play();
             MessageBox.Show("很遗憾!\r\n电脑获胜!", "温馨提示");
             this.canPlay = false;
             return;
         }
         if (!this.computerFirst)
         {
             this.foot += 1;
         }
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!this.canPlay)
     {
         this.canPlay = true;
     }
     this.table = new int[15, 15];
     this.richPictureBox1.Clear();
     this.listBox1.Items.Clear();
     this.recordList.Clear();
     this.foot = 1;
     if (this.computerFirst)
     {
         Point p = Explore.FindOptimalPoint(this.table);
         this.Reword(p, false);
     }
 }