Ejemplo n.º 1
0
        private void MyCircle_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            Ellipse clickdot = ((Ellipse)sender);

            if (!OnlyOneSelected)
            {
                PreviousEl = clickdot;
                if (!gameState.Jugador)//0 Max
                {
                    clickdot.Stroke = Brushes.Blue;
                }
                else
                {
                    clickdot.Stroke = Brushes.Red;//Min Rojo
                }
                clickdot.StrokeThickness = 3;
                TAGPrevious     = (TAGInfo)clickdot.Tag;
                OnlyOneSelected = true;
            }
            else
            {
                OnlyOneSelected = false;
                if (TAGPrevious.TAG == ((TAGInfo)clickdot.Tag).TAG)
                {
                    clickdot.Stroke          = Brushes.Black;
                    clickdot.StrokeThickness = 1;
                }
                else
                {
                    double  x1 = TAGPrevious.X + 10;
                    double  x2 = ((TAGInfo)clickdot.Tag).X + 10;
                    double  y1 = TAGPrevious.Y + 10;
                    double  y2 = ((TAGInfo)clickdot.Tag).Y + 10;
                    DotLine linetodraw;
                    //Sirve para izquierda a derecha y arriba hacia abajo
                    linetodraw = gameState.ItemsLine.Where(x => (x.X1 == x1 && x.Y1 == y1 && x.X2 == x2 && x.Y2 == y2) ||
                                                           (x.X1 == x2 && x.Y1 == y2 && x.X2 == x1 && x.Y2 == y1)).SingleOrDefault();
                    linetodraw?.DrawLine();
                    PreviousEl.Stroke          = Brushes.Black;
                    PreviousEl.StrokeThickness = 1;



                    //Dibujar rectangulito
                    Thread.Sleep(10);
                    DrawBox();
                    while (gameState.Jugador)
                    {
                        //Hacer jugada por parte de la maquina

                        var          tem = Alg.MaxValue(gameState.BooleanRepresentation(), float.MinValue + 1, float.MaxValue - 1, 4);
                        BooleanState t   = Alg.Result;
                        gameState.UpdateGame(t);
                        DrawBox();
                    }
                }
            }
        }