Beispiel #1
0
 private void NormalizeAllMovements(ISetOfMovements setOfMovements, double newLength)
 {
     foreach (var mov in setOfMovements.Movements)
     {
         Movements.Add(new UniversalMovement(mov, g => new NormalizedGraph(g, newLength)));
     }
 }
Beispiel #2
0
        public Movement MakeAMove(Player player, byte x, byte y)
        {
            // verifica se o jogo ja acabou
            if (IsFinish)
            {
                throw new InvalidOperationException("Partida finalizada");
            }

            // verifica se é a vez do jogador
            if (PlayerTurn != player)
            {
                throw new InvalidOperationException($"Não é o turno do jogador");
            }

            // verifica se posição esta disponivei
            if (Movements.Any(m => m.Position.X == x && m.Position.Y == y))
            {
                throw new InvalidOperationException("Posição já tomada anteriormente");
            }

            // Adiciona o movimento
            ToggleTurn();
            var move = new Movement(player, new Position(x, y));

            Movements.Add(move);

            // Tentamos pegar o vencedor
            Winner = GetWinner();

            return(move);
        }
Beispiel #3
0
        //Menu para recargar redes
        public void MenuRed()
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("----------RECARGAR REDES SOCIALES----------");
                Console.WriteLine("1) 500MB para redes sociales \n " +
                                  "2) Regresar.");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (currentBalance >= 4)
                    {
                        Console.WriteLine("Se han agregado 500MB para redes sociales ");
                        dataRedes += 500;
                        Movements.Add(new Movement(4, "Se agregaron 500MB para redes sociales"));
                    }
                    else
                    {
                        Console.WriteLine("Su saldo es insuficiente");
                    } break;

                case 2: break;

                default: Console.WriteLine("Opcion invalida"); break;
                }
            }
        }
Beispiel #4
0
 /// <summary>
 ///		Crea un movimiento real
 /// </summary>
 private MovementFigureDoubleViewModel CreateRealMovement(MovementFigureDoubleViewModel lastMovement, MovementFigureModel move,
                                                          int movementIndex, int movementLineIndex)
 {
     // Si es necesario, crea un nuevo movimiento
     if (lastMovement == null)
     {
         lastMovement = new MovementFigureDoubleViewModel(movementIndex, movementLineIndex);
         Movements.Add(lastMovement);
     }
     // Asigna el movimiento de blancas / negras
     if (move.Color == Bau.Libraries.LibChessGame.Board.Pieces.PieceBaseModel.PieceColor.White)
     {
         // Asigna el movimiento de blancas
         lastMovement.WhiteMovement = new MovementFigureViewModel(PgnGameViewModel, move, movementIndex, 0);
         // Carga la variación
         if (MustShowVariations(move))
         {
             LoadVariationMovements(move.Variation, movementIndex, movementLineIndex, 1);
             lastMovement = null;
         }
     }
     else             // Asigna el movimiento de negras
     {
         // Asigna el movimiento de negras
         lastMovement.BlackMovement = new MovementFigureViewModel(PgnGameViewModel, move, movementIndex, 0);
         // Carga la variación
         if (MustShowVariations(move))
         {
             LoadVariationMovements(move.Variation, movementIndex, movementLineIndex, 1);
         }
         lastMovement = null;
     }
     // Devuelve el último movimiento añadido a la lista
     return(lastMovement);
 }
Beispiel #5
0
        public void MenuNavigation()//Metodo en la navegacion de web
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("<<<<<<<<<<<RECARGAR PARA NAVEGACION EN LA WEB>>>>>>>>");
                Console.WriteLine("1) 500MB para navegacion -------$5.00" + "\n2) Regresar" + "\n Opcion: ");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (currentBalance >= 4)
                    {
                        Console.Write("Se han agregado 500MB para navegacion web ");
                        dataNavegation += 500;
                        Movements.Add(new Movement(5, "Se agregaron 500MB navegacion para web"));
                    }

                    else
                    {
                        Console.WriteLine("Saldo Insuficiente");
                    }
                    break;

                case 2: break;

                default: Console.WriteLine("Opcion No valida"); break;
                }
            }
        }
Beispiel #6
0
        public void MenuRed()//Metodo para la navegacion en al redes sociales
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("<<<<<<<<<<<RECARGAR PARA REDES SOCIALES>>>>>>>>");
                Console.WriteLine("1) 500MB para solo redes sociales -------$4.00" + "\n2) Regresar" + "\n Opcion: ");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (currentBalance >= 4)
                    {
                        Console.Write("Se han agregado 500MB para redes sociales ");
                        dataRedes += 500;
                        Movements.Add(new Movement(4, "Se agregaron 500MB"));
                    }

                    else
                    {
                        Console.WriteLine("Saldo Insuficiente");
                    }
                    break;

                case 2: break;

                default: Console.WriteLine("Opcion No valida"); break;
                }
            }
        }
Beispiel #7
0
        public override void PlayMusic()
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("<<<<<<<<<<<MUSICA EN SPOTIFY>>>>>>>>");
                Console.WriteLine("1) Escucgar una cancion " + "\n2) Regresar" + "\n Opcion: ");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (ncancion >= 1)
                    {
                        Console.Write("Ingrese el nombre de la cancion: ");
                        string song = Console.ReadLine();
                        Console.WriteLine($"Reproduciendo la cancion {song} en Spotify");
                        Movements.Add(new Movement(1, $"Reproduccion  {song} en Spotify"));
                        ncancion -= 1;
                    }

                    else
                    {
                        Console.WriteLine("Ya no tiene canciones disponibles en Spotify");
                    }
                    break;

                case 2: break;

                default: Console.WriteLine("Opcion No valida"); break;
                }
            }
        }
Beispiel #8
0
        public void ReloadSongs()
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("<<<<<<<<<<<RECARGA DE CANCIONES>>>>>>>>");
                Console.WriteLine("1) 200 canciones Spotify ---- $3.00 " + "\n2) Regresar" + "\n Opcion: ");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (currentBalance >= 3)
                    {
                        Console.Write("Se han agregado las 200 canciones en Spotify, a disfrutar...");
                        ncancion += 200;
                        Movements.Add(new Movement(3, "Agrego 200 canciones en spotify"));
                    }

                    else
                    {
                        Console.WriteLine("Insuficiente saldo");
                    }
                    break;

                case 2: break;

                default: Console.WriteLine("Opcion No valida"); break;
                }
            }
        }
Beispiel #9
0
        public void NavegationWeb()//Navegacion en la Web
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("<<<<<<<<<<<NAVEGACION EN LA WEB>>>>>>>>");
                Console.WriteLine("1) Navegar en una pagina " + "\n2) Regresar" + "\n Opcion: ");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (dataNavegation >= 4)
                    {
                        Console.Write("Ingrese el nombre de la pagina a navegar: ");
                        string webPage = Console.ReadLine();
                        Console.WriteLine($"Historial---pagina web {webPage} ");
                        dataNavegation -= 4; //restando 4 MB
                        Movements.Add(new Movement(4, $"Navegacion en {webPage}"));
                    }

                    else
                    {
                        Console.WriteLine("No tiene suficiente megas para navegar en la web");
                    }
                    break;

                case 2: break;

                default: Console.WriteLine("Opcion No valida"); break;
                }
            }
        }
Beispiel #10
0
        //Metodo para recargar canciones
        public void ReloadSongs()
        {
            int option;

            do
            {
                Console.WriteLine("-----Recargar Canciones-----\n" +
                                  "1) 200 canciones en Spotify -$3.00\n" +
                                  "2) Salir\n" +
                                  "Opción elegida: ");
                option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (currentBalance >= 3)
                    {
                        Console.WriteLine("Se han agregado 200 canciones de Spotify, a disfrutar.....");
                        ncancion += 200;
                        Movements.Add(new Movement(3, "Agrego 200 canciones a Spotify"));
                    }
                    else
                    {
                        Console.WriteLine("Su saldo es insuficiente :(");
                    } break;

                case 2: break;

                default: Console.WriteLine("Opcion erronea"); break;
                }
            }while(option != 1);
        }
Beispiel #11
0
        //Menu para recargar navegacion general
        public void MenuWeb()
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("----------RECARGAR NAVEGACION----------");
                Console.WriteLine("1) 500MB Navegcion general \n " +
                                  "2) Regresar.");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    if (currentBalance <= 5)
                    {
                        Console.WriteLine("Se han agregado 500MB para navegacion general ");
                        dataNavegation += 500;
                        Movements.Add(new Movement(5, "Se agregaron 500MB para navegacion general"));
                    }
                    else
                    {
                        Console.WriteLine("Su saldo es insuficiente");
                    } break;

                case 2: break;

                default: Console.WriteLine("Opcion invalida"); break;
                }
            }
        }
Beispiel #12
0
 public void AddMovement(string newLocation)
 {
     Movements.Add(new FileMovement()
     {
         Date = DateTime.Now, NewLocation = newLocation, OldLocation = CurrentLocation
     });
     CurrentLocation = newLocation;
 }
Beispiel #13
0
        private void CreateMeanMovements(ISetOfExperiments setOfExperiments)
        {
            int numberOfMovements = GetNumOfMovements(setOfExperiments);

            for (int i = 0; i < numberOfMovements; i++)
            {
                Movements.Add(new MeanMovement(AccumulateMovementsFrom(indexOfMovement: i, setOfExperiments)));
            }
        }
Beispiel #14
0
        public override void TryMovement(Vector3Int coord)
        {
            if (!CellsController.CanMove(CurrentCoordinate + coord))
            {
                return;
            }

            _clonesController.NextStep();
            CurrentCoordinate += coord;
            _characterMovement.MoveToPosition(CurrentCoordinate, MovementFinished);
            Movements.Add(CurrentCoordinate);
        }
Beispiel #15
0
        public void RechargeBalances()
        {
            double balance;

            do
            {
                Console.Write("Introduzca el saldo a recargar:");
                balance = Double.Parse(Console.ReadLine());
            }while(balance <= 0);
            currentBalance += balance;
            Console.WriteLine($"Se ha recargado {currentBalance} a su Telefono");
            Movements.Add(new Movement(balance, "Recargar de saldo"));
        }
Beispiel #16
0
 /// <summary>
 ///		Carga los movimientos de la variación
 /// </summary>
 internal void LoadMovements(List <BaseMovementViewModel> movements)
 {
     // Limpia los movimientos
     Movements.Clear();
     // Inicializa los movimientos
     if (movements?.Count == 0)
     {
         Movements.Add(new MovementRemarkViewModel("No hay ningún movimiento en este juego"));
     }
     else
     {
         LoadVariationMovements(movements);
     }
 }
Beispiel #17
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                _template.ReadString(reader);
                for (x = 0; (x < _movements.Count); x = (x + 1))
                {
                    Movements.Add(new ParticleControllerBlock());
                    Movements[x].Read(reader);
                }
                for (x = 0; (x < _movements.Count); x = (x + 1))
                {
                    Movements[x].ReadChildData(reader);
                }
            }
Beispiel #18
0
        //metodo para recargar saldo
        public void RechargeBalances()
        {
            double balanceE;

            Console.WriteLine("Cunato saldo desea recargar?");

            do //validacion para comprobar que el saldo no sea negativo
            {
                balanceE = Convert.ToDouble(Console.ReadLine());
            }while(balanceE <= 0);

            currentBalance += balanceE;
            Console.WriteLine("El saldo ha sido agreditado a su telefono");
            Movements.Add(new Movement(balanceE, $"Recarga de saldo"));
        }
Beispiel #19
0
        /// <summary>
        ///		Carga en la lista una variación de movimientos
        /// </summary>
        private void LoadVariationMovements(VariationModel variation, int movementIndex, int movementLineIndex, int variationIndex)
        {
            MovementFigureDoubleViewModel          lastMovement          = null;
            MovementFigureVariationDoubleViewModel lastRecursiveMovement = null;

            foreach (MovementBaseModel movement in variation.Movements)
            {
                switch (movement)
                {
                case MovementFigureModel move:
                    // Añade a la lista un movimiento real o un movimiento recursivo
                    if (variationIndex == 0)
                    {
                        // Añade el movimiento a la lista de movimientos de piezas (sin comentarios)
                        FigureMovements.Add(move);
                        // Crea el movimiento para la lista
                        lastMovement          = CreateRealMovement(lastMovement, move, movementIndex, movementLineIndex);
                        lastRecursiveMovement = null;
                    }
                    else if (PgnGameViewModel.ShowVariations)
                    {
                        lastRecursiveMovement = CreateRecursiveMovement(lastRecursiveMovement, move, movementIndex, movementLineIndex, variationIndex);
                        lastMovement          = null;
                    }
                    // Incrementa los índices de movimientos
                    movementIndex++;
                    if (move.Color == Bau.Libraries.LibChessGame.Board.Pieces.PieceBaseModel.PieceColor.Black)
                    {
                        movementLineIndex++;
                    }
                    break;

                case MovementRemarksModel move:
                    Movements.Add(new MovementRemarkViewModel(move));
                    lastMovement          = null;
                    lastRecursiveMovement = null;
                    break;

                case MovementGameEndModel move:
                    Movements.Add(new MovementGameEndViewModel(move));
                    lastMovement          = null;
                    lastRecursiveMovement = null;
                    break;
                }
            }
        }
Beispiel #20
0
 private void initCommands()
 {
     AddCommand = new DelegateCommand(delegate(object arg)
     {
         var man = arg as Movement;
         Movements.Add(man);
     });
     RemoveCommand = new DelegateCommand(delegate(object arg)
     {
         var man = arg as Movement;
         Movements.Remove(man);
     });
     MoveUpCommand = new DelegateCommand(delegate(object arg)
     {
         var man = arg as Movement;
         for (int i = 1; i < Movements.Count; i++)
         {
             if (man == Movements[i])
             {
                 var ki           = Movements[i];
                 Movements[i]     = Movements[i - 1];
                 Movements[i - 1] = ki;
                 break;
             }
         }
     });
     MoveDownCommand = new DelegateCommand(delegate(object arg)
     {
         var man = arg as Movement;
         for (int i = 0; i < Movements.Count - 1; i++)
         {
             if (man == Movements[i])
             {
                 var ki           = Movements[i];
                 Movements[i]     = Movements[i + 1];
                 Movements[i + 1] = ki;
                 break;
             }
         }
     });
 }
Beispiel #21
0
 /// <summary>
 ///		Carga los movimientos de la variación
 /// </summary>
 internal void LoadMovements(VariationModel variation)
 {
     // Limpia los movimientos
     Movements.Clear();
     FigureMovements.Clear();
     // Inicializa el tablero
     GameBoard = new GameBoardModel(variation);
     GameBoard.Reset();
     // Carga los movimientos
     if (variation != null)
     {
         LoadVariationMovements(variation, 1, 1, 0);
     }
     // Añade un comentario si no había ningún movimiento
     if (Movements.Count == 0)
     {
         Movements.Add(new MovementRemarkViewModel(new MovementRemarksModel("No hay ningún movimiento en este juego")));
     }
     // Inicializa los movimientos
     _actualMovementIndex = 0;
 }
Beispiel #22
0
        /// <summary>
        ///		Carga en la lista una variación de movimientos
        /// </summary>
        private void LoadVariationMovements(List <BaseMovementViewModel> movements)
        {
            MovementFigureDoubleViewModel lastMovement = null;
            int movementIndex = 1;

            foreach (BaseMovementViewModel movement in movements)
            {
                switch (movement)
                {
                case MovementFigureViewModel move:
                    // Añade a la lista un movimiento real o un movimiento recursivo
                    if (lastMovement == null)
                    {
                        lastMovement = new MovementFigureDoubleViewModel(movementIndex);
                        Movements.Add(lastMovement);
                    }
                    // Asigna el movimiento de negras o blancas
                    if (move.Color == Models.Pieces.PieceBaseModel.PieceColor.Black)
                    {
                        // Asigna el movimiento de negras
                        lastMovement.BlackMovement = move;
                        // Incrementa el índice y vacía el último movimiento
                        movementIndex++;
                        lastMovement = null;
                    }
                    else
                    {
                        lastMovement.WhiteMovement = move;
                    }
                    break;

                case MovementGameEndViewModel move:
                    Movements.Add(move);
                    lastMovement = null;
                    break;
                }
            }
        }
Beispiel #23
0
        public Maneuver(Maneuver copy, bool isDuplicate)
        {
            Uid = uids++;

            if (isDuplicate)
            {
                Name = copy.Name + "- Copy";
            }
            else
            {
                Name = copy.Name;
            }
            Movement[] target = new Movement[copy.Movements.Count];
            copy.Movements.CopyTo(target, 0);
            this.Movements = new ObservableCollection <Movement>();
            foreach (var item in target)
            {
                item.Host = this;
                Movements.Add(item);
            }

            initCommands();
        }
Beispiel #24
0
        public void NavegationRedes()//Navegacion en la Redes Sociales
        {
            bool status = true;

            while (status)
            {
                Console.WriteLine("<<<<<<<<<<<NAVEGACION EN LAS REDES SOCIALES>>>>>>>>");
                Console.WriteLine("1) Ingresar a una red social " + "\n2) Regresar" + "\n Opcion: ");
                int option = Int32.Parse(Console.ReadLine());

                switch (option)
                {
                case 1:
                    Console.Write("Ingrese el tiempo que estara en la red social en minutos: ");
                    int time = Int32.Parse(Console.ReadLine());
                    Console.Write("Ingrese el nombre de la Red Social: ");
                    string social = Console.ReadLine();
                    if (dataRedes >= time * 2)
                    {
                        Console.WriteLine($"Ha ingreasado a la red social {social} con sus {time} minutos ");
                        dataRedes -= time * 2;
                        Movements.Add(new Movement(time * 2, $"Navego en la red social {social}"));
                    }

                    else
                    {
                        Console.WriteLine("No tiene suficiente megas para navegar en las redes sociales ");
                    }
                    break;

                case 2: break;

                default: Console.WriteLine("Opcion No valida"); break;
                }
            }
        }
Beispiel #25
0
            private TileLocation ProcessMovement(Movement movement)
            {
                var response = new TileLocation();

                switch (movement.Direction)
                {
                case Direction.Right:
                    for (int i = 1; i < movement.Length; i++)
                    {
                        Locations.Add(new TileLocation()
                        {
                            X = CurrentLocation.X + i,
                            Y = CurrentLocation.Y
                        });
                    }
                    response = new TileLocation()
                    {
                        X = CurrentLocation.X + movement.Length,
                        Y = CurrentLocation.Y
                    };
                    break;

                case Direction.Left:
                    for (int i = 1; i < movement.Length; i++)
                    {
                        Locations.Add(new TileLocation()
                        {
                            X = CurrentLocation.X - i,
                            Y = CurrentLocation.Y
                        });
                    }
                    response = new TileLocation()
                    {
                        X = CurrentLocation.X - movement.Length,
                        Y = CurrentLocation.Y
                    };
                    break;

                case Direction.Up:
                    for (int i = 1; i < movement.Length; i++)
                    {
                        Locations.Add(new TileLocation()
                        {
                            X = CurrentLocation.X,
                            Y = CurrentLocation.Y + i
                        });
                    }
                    response = new TileLocation()
                    {
                        X = CurrentLocation.X,
                        Y = CurrentLocation.Y + movement.Length
                    };
                    break;

                case Direction.Down:
                    for (int i = 1; i < movement.Length; i++)
                    {
                        Locations.Add(new TileLocation()
                        {
                            X = CurrentLocation.X,
                            Y = CurrentLocation.Y - i
                        });
                    }
                    response = new TileLocation()
                    {
                        X = CurrentLocation.X,
                        Y = CurrentLocation.Y - movement.Length
                    };
                    break;

                default: {
                    throw new Exception("Not Supported");
                }
                }

                Movements.Add(movement);
                Locations.Add(response);
                return(response);
            }
Beispiel #26
0
 private void Start()
 {
     _characterMovement = new CharacterMovement(this, transform, MOVE_SPEED);
     CurrentCoordinate  = Vector3Int.zero;
     Movements.Add(transform.position);
 }
Beispiel #27
0
 public override void Reset()
 {
     Movements.Clear();
     Movements.Add(CurrentCoordinate);
     _characterMovement.Reset();
 }