Ejemplo n.º 1
0
 private void panel1_MouseClick(object sender, MouseEventArgs e)
 {
     if (!gamenode.GameInProgress())
     {
         NewGame();
         return;
     }
     if ((gamenode.ActivePlayer == 0 && !checkBox0.Checked) || (gamenode.ActivePlayer == 1 && !checkBox1.Checked))
     {
         int x = ReversiNode.size * e.Location.X / panel1.Width;
         int y = ReversiNode.size * e.Location.Y / panel1.Height;
         y = ReversiNode.size - 1 - y;
         int move = ReversiNode.size * x + y;
         if (!gamenode.MoveIsLegal(move))
         {
             return;
         }
         gamenode = gamenode.DoMove(move) as ReversiNode;
         backgroundWorker1.RunWorkerAsync();
     }
 }