Ejemplo n.º 1
0
        /// <summary>
        /// Carrega em memória os valores da "Matriz energética"
        /// </summary>
        public static void LoadEnergeticMatrix(Param param)
        {
            int N = GCPS.chain.r.Count;              //número de residuos

            GCPS.energeticMatrix = new double[N, N]; //Matriz M quadrada (NxN)

            for (int i = 0; i < (N - 1); i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    if (i == j)
                    {
                        GCPS.energeticMatrix[i, j] = 0;
                    }
                    else
                    {
                        double r = 0;

                        if (GCPS.modelType == 0)
                        {
                            //0-Randon

                            //Sorteio randomico
                            Randomic.Random();
                            r = (Randomic.randu * 2) - 1; //R´=(R*2)-1
                        }
                        else if (GCPS.modelType == 1)
                        {
                            //1-H (Hidrofobico)
                            r = -1;
                        }
                        else if (GCPS.modelType == 2)
                        {
                            //2-P (Polar)
                            r = 1;
                        }

                        else //if (GCPS.modelType == 2)
                        {
                            //3-HP;4-estero-quimico,5-GO

                            //O AJUSTE SOMENTE É VALIDO PARA MODELO HP
                            //Onde: H=-, P=+
                            //Sendo: Eij(H,H) = -1, Eij(H,P)=0, Eij(P,P)= +1

                            if (param.model[i].value == -1 && param.model[j].value == -1)
                            {
                                r = -1;
                            }
                            else if (param.model[i].value == 1 && param.model[j].value == 1)
                            {
                                r = 1;
                            }
                        }
                        GCPS.energeticMatrix[i, j] = r;
                        GCPS.energeticMatrix[j, i] = r;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Prepara aplicação para gerar uma nova ISEM
 /// </summary>
 public static void ClearAppToGenNewIsem()
 {
     GCPS.chain.r.Clear();
     Randomic.Random();
     GCPS.initialIsem      = AppConfigClient.Param.dataToProcess.isem < 0 ? (AppConfigClient.Param.dataToProcess.isem * -1) : AppConfigClient.Param.dataToProcess.isem;
     GCPS.chain.isem       = GCPS.initialIsem;
     GCPS.chain.chainTypes = null;
 }
        /// <summary>
        /// Sorteia o Monomero o qual ocorreá a tentiva de movimento
        /// </summary>
        /// <returns>Retorna a posição do Monomero</returns>
        public static void SortMoviment()
        {
            Randomic.Random();

            int selectNode = (int)(Randomic.randu * GCPS.chain.r.Count);

            GCPS.chain.selectNode = GCPS.tempChain.selectNode = selectNode;
        }
Ejemplo n.º 4
0
        public void TwoDifferentNumbersWhenSettingAndResetingSeed()
        {
            Randomic.SetSeed(1234);
            int number1 = Randomic.Basic.Int();

            Randomic.ResetSeed();
            int number2 = Randomic.Basic.Int();

            Assert.AreNotEqual(number1, number2);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// use this method just for generating a new UID.
        /// </summary>
        /// <param name="_username_"></param>
        /// <param name="_socket_"></param>
        /// <returns></returns>
        public static async Task <UID> GenerateUID(StrongString _username_, IPlayerSocket _socket_)
        {
            int          myIndex = Randomic.GetRandom(MIN_SERVER_INDEX, MAX_SERVER_INDEX);
            var          _s      = ThereIsServer.ServersInfo.ServerManager.Get_UID_Generation_Server(myIndex);
            StrongString _target = ServerManager.Generation_Location_Name;
            UID          uid;
            ulong        _value;

            for (var i = 0; ; i++)
            {
                var existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target);

                if (existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed)
                {
                    NoInternetConnectionSandBox.PrepareConnectionClosedSandBox();
                    return(null);
                }
                _value = existing.Decode().ToUInt64();
                _value++;
                var _req = new DataBaseUpdateRequest(UID_MESSAGE, _value.ToString(UID_FORMAT),
                                                     existing.Sha.GetStrong());
                var _result = await ThereIsServer.Actions.UpdateDataOnce(_s, _target, _req);

                if (_result.IsDeadCallBack)
                {
                    continue;
                }
                if (ThereIsServer.ServerSettings.HasConnectionClosed || i >= MAX_TRY)
                {
                    return(null);
                }
                break;
            }
            //----------------------
            uid     = new UID(myIndex, _value, _socket_, _username_);
            _s      = ThereIsServer.ServersInfo.ServerManager.Get_UID_Server(uid);
            _target = uid.GetValue() + UID_Lcation_Name;
            var _creation = new DataBaseCreation(UID_MESSAGE, QString.Parse(uid.GetForServer()));
            await ThereIsServer.Actions.CreateData(_s, _target, _creation);

            //----------------------
            _s        = ThereIsServer.ServersInfo.ServerManager.Get_UID_Server(_username_);
            _target   = _username_ + USERNAME_TO_UID;
            _creation = new DataBaseCreation(UID_MESSAGE, QString.Parse(uid.GetValue()));
            await ThereIsServer.Actions.CreateData(_s, _target, _creation);

            //----------------------


            return(uid);
        }
Ejemplo n.º 6
0
        public void Complement()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string ptBr = Randomic.Address.Complement();

            Assert.AreEqual("Fundos 249", ptBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string enUs = Randomic.Address.Complement();

            Assert.AreEqual("Apt. 249", enUs);
        }
Ejemplo n.º 7
0
        public void Name()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string ptBr = Randomic.Address.Name();

            Assert.AreEqual("Denise Galileo", ptBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string enUs = Randomic.Address.Name();

            Assert.AreEqual("Creagen Galileo", enUs);
        }
Ejemplo n.º 8
0
        public void FullAddress()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            var ptBr = Randomic.Address.FullAddress();

            Assert.AreEqual("Bosque Denise Galileo, 24867 - Jardim Assunção, Cuiabá - ES, 32587540", ptBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            var enUs = Randomic.Address.FullAddress();

            Assert.AreEqual("24867 Creagen Galileo Street, Des Moines, IL, 32587", enUs);
        }
Ejemplo n.º 9
0
        public void ZipCode()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            var ptBr = Randomic.Address.ZipCode();

            Assert.AreEqual("32587540", ptBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            var enUs = Randomic.Address.ZipCode();

            Assert.AreEqual("32587", enUs);
        }
Ejemplo n.º 10
0
        public void Country()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string ptBr = Randomic.Address.Country();

            Assert.AreEqual("Dinamarca", ptBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string enUs = Randomic.Address.Country();

            Assert.AreEqual("Dominica", enUs);
        }
Ejemplo n.º 11
0
        public void City()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string ptBr = Randomic.Address.City();

            Assert.AreEqual("Cuiabá", ptBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string enUs = Randomic.Address.City();

            Assert.AreEqual("Des Moines", enUs);
        }
Ejemplo n.º 12
0
        public void Neighborhood()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string ptBr = Randomic.Address.Neighborhood();

            Assert.AreEqual("Jardim Assunção", ptBr);

            // EnUs (not available)
            Randomic.SetLanguage(Language.EnUs);
            string enUs = Randomic.Address.Neighborhood();

            Assert.AreEqual("", enUs);
        }
Ejemplo n.º 13
0
        public void Prefix()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string prefixPtBr = Randomic.People.Prefix();

            Assert.AreEqual("Sr.", prefixPtBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string prefixEnUs = Randomic.People.Prefix();

            Assert.AreEqual("Mrs.", prefixEnUs);
        }
Ejemplo n.º 14
0
        public void FullName()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string namePtBr = Randomic.People.FullName();

            Assert.AreEqual($"{PT_BR_FIRST_NAME} {PT_BR_LAST_NAME}", namePtBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string nameEnUs = Randomic.People.FullName();

            Assert.AreEqual($"{EN_US_FIRST_NAME} {EN_US_LAST_NAME}", nameEnUs);
        }
Ejemplo n.º 15
0
        public void LastName()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string namePtBr = Randomic.People.LastName();

            Assert.AreEqual(PT_BR_LAST_NAME, namePtBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string nameEnUs = Randomic.People.LastName();

            Assert.AreEqual(EN_US_LAST_NAME, nameEnUs);
        }
Ejemplo n.º 16
0
        public void Email()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string emailPtBr = Randomic.Internet.Email();

            Assert.AreEqual("*****@*****.**", emailPtBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string emailEnUs = Randomic.Internet.Email();

            Assert.AreEqual("*****@*****.**", emailEnUs);
        }
Ejemplo n.º 17
0
        public void Planet()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string planetPtBr = Randomic.Words.Planet();

            Assert.AreEqual("Vênus", planetPtBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string planetEnUs = Randomic.Words.Planet();

            Assert.AreEqual("Venus", planetEnUs);
        }
Ejemplo n.º 18
0
 private StrongString GenerateNew()
 {
     LoginS_Index        = Randomic.GetRandom(MIN_T, MAX_0);
     PlayerInfoS_Index   = Randomic.GetRandom(MIN_T, MAX_1);
     MeS_Index           = Randomic.GetRandom(MIN_T, MAX_2);
     PlayerS_Index       = Randomic.GetRandom(MIN_T, MAX_3);
     TroopS_Index        = Randomic.GetRandom(MIN_T, MAX_4);
     MagicalTroopS_Index = Randomic.GetRandom(MIN_T, MAX_5);
     ResourcesS_Index    = Randomic.GetRandom(MIN_T, MAX_6);
     PlayerHeroesS_Index = Randomic.GetRandom(MIN_T, MAX_7);
     SecuredMeS_Index    = Randomic.GetRandom(MIN_T, MAX_8);
     PlayerItemsS_Index  = Randomic.GetRandom(MIN_T, MAX_9);
     return(SumSalvation());
 }
Ejemplo n.º 19
0
        public void Noun()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string wordPtBr = Randomic.Words.Noun();

            Assert.AreEqual("Conselho", wordPtBr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string wordEnUs = Randomic.Words.Noun();

            Assert.AreEqual("Control", wordEnUs);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Generate a new random Hero with
        /// the Element.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public static Hero GenerateHero(PlayerElement element)
        {
            Hero myHero = new Hero();
            int  Range1 =
                Convert.ToInt32(
                    myHero.MyRes.GetString(element.ToString() + RangeStringInRes + 1));
            int Range2 =
                Convert.ToInt32(
                    myHero.MyRes.GetString(element.ToString() + RangeStringInRes + 2));
            int nowInt = Randomic.GetRandom(Range1, Range2);

            myHero.SetHeroFromBlank(nowInt.ToString());
            myHero.ServerIndex = Randomic.GetRandom(ServerManager.MIN_T, ServerManager.MAX_HEROES_INFO_SERVERS);
            return(myHero); // not completed yet.
        }
Ejemplo n.º 21
0
        public static                CardInfo[] GenerateDeck()
        {
            var res   = new CardInfo[40];
            int index = 0;

            foreach (var i in CardInfo.Numbers)
            {
                res[index]     = new CardInfo(Suit.Bastos, i);
                res[index + 1] = new CardInfo(Suit.Copas, i);
                res[index + 2] = new CardInfo(Suit.Espadas, i);
                res[index + 3] = new CardInfo(Suit.Oros, i);

                index += 4;
            }

            // Shuffle
            return(res.OrderBy((c) => Randomic.Rand()).ToArray());
        }
Ejemplo n.º 22
0
        public void State()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            var ptBr = Randomic.Address.State();

            Assert.AreEqual("Espírito Santo", ptBr.Name);
            Assert.AreEqual("ES", ptBr.Abbreviation);
            Assert.AreEqual("Vitória", ptBr.Capital);
            Assert.AreEqual(ptBr.Name, ptBr.ToString());

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            var enUs = Randomic.Address.State();

            Assert.AreEqual("Illinois", enUs.Name);
            Assert.AreEqual("IL", enUs.Abbreviation);
            Assert.AreEqual("Springfield", enUs.Capital);
            Assert.AreEqual(enUs.Name, enUs.ToString());
        }
Ejemplo n.º 23
0
        public void Type()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            string ptBr = Randomic.Address.Type();

            Assert.AreEqual("Bosque", ptBr);
            string ptBrAbbr = Randomic.Address.TypeAbbreviated();

            Assert.AreEqual("Bq.", ptBrAbbr);

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            string enUs = Randomic.Address.Type();

            Assert.AreEqual("Street", enUs);
            string enUsAbbr = Randomic.Address.TypeAbbreviated();

            Assert.AreEqual("St.", enUsAbbr);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Rotina o qual costroi a cadeia de monomeros
        /// </summary>
        /// <param name="lastValed">posição do último monomero válido</param>
        public static void CreateStruct(ref int lastValed)
        {
            while (GCPS.chain.r.Count < AppConfigClient.Param.dataToProcess.totalSitio)
            {
                BasicStructs.Point tempCoord = new BasicStructs.Point(); //Crio uma coordenada temporária

                lastValed = GCPS.chain.r.Count - 1;

                tempCoord.x = GCPS.chain.r[lastValed].x; //Copia o último ponto válido para a coordenada temporária
                tempCoord.y = GCPS.chain.r[lastValed].y;
                tempCoord.z = GCPS.chain.r[lastValed].z;

                tempCoord.deadEndPoints = string.Empty;
                tempCoord.deadEnd       = 0;

                //Sorteira X,Y ou Z
                Randomic.Random();
                if (Randomic.randu < Consts.rXYZ) //X
                {
                    Randomic.Random();
                    tempCoord.x = Randomic.randu < 0.5 ? tempCoord.x - 1 : tempCoord.x + 1; //escolhe +/- 1
                }
                else if (Randomic.randu < (Consts.rXYZ * 2))                                //Y
                {
                    Randomic.Random();
                    tempCoord.y = Randomic.randu < 0.5 ? tempCoord.y - 1 : tempCoord.y + 1; //escolhe +/- 1
                }
                else
                {                                                                           //Z
                    Randomic.Random();
                    tempCoord.z = Randomic.randu < 0.5 ? tempCoord.z - 1 : tempCoord.z + 1; //escolhe +/- 1
                }


                //aidiconar valor de enegia inicial
                tempCoord.e = new List <TypeE>();

                //adiciona o novo ponto
                GCPS.chain.r.Add(tempCoord);
            }
        }
Ejemplo n.º 25
0
        public void Phone()
        {
            // PtBr
            Randomic.SetLanguage(Language.PtBr);
            var ptBr = Randomic.Address.Phone();

            Assert.AreEqual("+55", ptBr.CountryCode);
            Assert.AreEqual("32", ptBr.AreaCode);
            Assert.AreEqual("32587540", ptBr.Number);
            Assert.AreEqual("3258-7540", ptBr.FormatedNumber);
            Assert.AreEqual("+55 32 3258-7540", ptBr.ToString());

            // EnUs
            Randomic.SetLanguage(Language.EnUs);
            var enUs = Randomic.Address.Phone();

            Assert.AreEqual("+1", enUs.CountryCode);
            Assert.AreEqual("325", enUs.AreaCode);
            Assert.AreEqual("3258754", enUs.Number);
            Assert.AreEqual("325-8754", enUs.FormatedNumber);
            Assert.AreEqual("+1 325 325-8754", enUs.ToString());
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Cria um Monometro
        /// </summary>
        /// <param name="tempCoord"></param>
        public static void CreateMono(ref BasicStructs.Point tempCoord)
        {
            tempCoord = GCPS.chain.r[GCPS.chain.r.Count - 1]; //Copia o último ponto válido para a coordenada temporária

            //Sorteira X,Y ou Z
            Randomic.Random();
            if (Randomic.randu < Consts.rXYZ) //X
            {
                Randomic.Random();
                tempCoord.x = Randomic.randu < 0.5 ? tempCoord.x - 1 : tempCoord.x + 1; //escolhe +/- 1
            }
            else if (Randomic.randu < (Consts.rXYZ * 2))                                //Y
            {
                Randomic.Random();

                tempCoord.y = Randomic.randu < 0.5 ? tempCoord.y - 1 : tempCoord.y + 1; //escolhe +/- 1
            }
            else
            {                                                                           //Z
                Randomic.Random();
                tempCoord.z = Randomic.randu < 0.5 ? tempCoord.z - 1 : tempCoord.z + 1; //escolhe +/- 1
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Sortei qual a posibilidade de moviment entre 1 e lenght
        /// </summary>
        /// <returns></returns>
        internal static int SortPossibilities(int lenght)
        {
            Randomic.Random();

            int ret = (int)(Randomic.randu * lenght);

            //Caso ocorra algum erro no sorteio o algoritmo finaliza a execução
            if (ret < 0 || ret > lenght)
            {
                new GridProteinFolding.Middle.Helpers.LoggingHelpers.Log().ErroParseMoves(new Middle.Helpers.LoggingHelpers.User_Defined_Exceptions.ErroParseMovesException("SortCrankShaftMove"), Types.ErrorLevel.None);

                throw new System.Exception();
                //CustomMessage customMessage = new CustomMessage();

                //throw new CustomException(SeverityLevel.Critical,
                //    LogLevel.Event,
                //    new ErroParseMoves("SortCrankShaftMove Exception"),
                //   customMessage.GetString("SortCrankShaftMove"));
            }
            else
            {
                return(ret);
            }
        }
Ejemplo n.º 28
0
 //-------------------------------------------------
 #region Set Method's Region
 private void SetParams(StrongString _value)
 {
     StrongString[] myStrings = _value.Split(CharSeparator);
     if (myStrings.Length > INDEX_0)
     {
         LoginS_Index = myStrings[INDEX_0].ToInt32();
     }
     else
     {
         LoginS_Index = Randomic.GetRandom(MIN_T, MAX_0);
     }
     if (myStrings.Length > INDEX_1)
     {
         PlayerInfoS_Index = myStrings[INDEX_1].ToInt32();
     }
     else
     {
         PlayerInfoS_Index = Randomic.GetRandom(MIN_T, MAX_1);
     }
     if (myStrings.Length > INDEX_2)
     {
         MeS_Index = myStrings[INDEX_2].ToInt32();
     }
     else
     {
         MeS_Index = Randomic.GetRandom(MIN_T, MAX_2);
     }
     if (myStrings.Length > INDEX_3)
     {
         PlayerS_Index = myStrings[INDEX_3].ToInt32();
     }
     else
     {
         PlayerS_Index = Randomic.GetRandom(MIN_T, MAX_3);
     }
     if (myStrings.Length > INDEX_4)
     {
         TroopS_Index = myStrings[INDEX_4].ToInt32();
     }
     else
     {
         TroopS_Index = Randomic.GetRandom(MIN_T, MAX_4);
     }
     if (myStrings.Length > INDEX_5)
     {
         MagicalTroopS_Index = myStrings[INDEX_5].ToInt32();
     }
     else
     {
         MagicalTroopS_Index = Randomic.GetRandom(MIN_T, MAX_5);
     }
     if (myStrings.Length > INDEX_6)
     {
         ResourcesS_Index = myStrings[INDEX_6].ToInt32();
     }
     else
     {
         ResourcesS_Index = Randomic.GetRandom(MIN_T, MAX_6);
     }
     if (myStrings.Length > INDEX_7)
     {
         PlayerHeroesS_Index = myStrings[INDEX_7].ToInt32();
     }
     else
     {
         PlayerHeroesS_Index = Randomic.GetRandom(MIN_T, MAX_7);
     }
     if (myStrings.Length > INDEX_8)
     {
         SecuredMeS_Index = myStrings[INDEX_8].ToInt32();
     }
     else
     {
         SecuredMeS_Index = Randomic.GetRandom(MIN_T, MAX_8);
     }
     if (myStrings.Length > INDEX_9)
     {
         PlayerItemsS_Index = myStrings[INDEX_9].ToInt32();
     }
     else
     {
         PlayerItemsS_Index = Randomic.GetRandom(MIN_T, MAX_9);
     }
 }
Ejemplo n.º 29
0
 public void Setup()
 {
     // Set the Seed to force always same results
     Randomic.SetSeed(1);
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Este Metodo executa o movimento de End.
        /// </summary>
        /// <returns>Return TRUE se o movimento ocorreu</returns>
        public bool Do()
        {
            Structs.BasicStructs.Point r1;
            Structs.BasicStructs.Point r2;

            if (GCPS.chain.selectNode == 0)
            {
                //r1 = Members.monomero.r[Members.monomero.selectNode];
                //r2 = Members.monomero.r[Members.monomero.selectNode + 1];

                //copia dos dados do monomero para movimento
                r1 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode].z
                };
                r1.e = new List <TypeE>();
                r1.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode].e);

                //copia dos dados do monomero para movimento
                r2 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode + 1].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode + 1].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode + 1].z
                };
                r2.e = new List <TypeE>();
                r2.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode + 1].e);
            }
            else
            {
                //r1 = Members.monomero.r[Members.monomero.selectNode];
                //r2 = Members.monomero.r[Members.monomero.selectNode - 1];

                //copia dos dados do monomero para movimento
                r1 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode].z
                };
                r1.e = new List <TypeE>();
                r1.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode].e);

                //copia dos dados do monomero para movimento
                r2 = new Structs.BasicStructs.Point()
                {
                    x = GCPS.chain.r[GCPS.chain.selectNode - 1].x,
                    y = GCPS.chain.r[GCPS.chain.selectNode - 1].y,
                    z = GCPS.chain.r[GCPS.chain.selectNode - 1].z
                };
                r2.e = new List <TypeE>();
                r2.e.AddRange(GCPS.chain.r[GCPS.chain.selectNode - 1].e);
            }

            //Vetor p, como sendo a difereça entre os vetores posuicao do residuo "2" e do residuo "1", isto é: p=r1-r1
            Structs.BasicStructs.Point p = new Structs.BasicStructs.Point()
            {
                x = r2.x - r1.x,
                y = r2.y - r1.y,
                z = r2.z - r1.z
            };


            //Definicao dos dois vetores v e w
            Structs.BasicStructs.Point v;
            Structs.BasicStructs.Point w;
            //cria as 3 possibilidades para v e w
            if (p.x != 0)
            {
                v = new Structs.BasicStructs.Point()
                {
                    x = 0, y = p.x, z = 0
                };
                w = new Structs.BasicStructs.Point()
                {
                    x = 0, y = 0, z = p.x
                };
            }
            else if (p.y != 0)
            {
                v = new Structs.BasicStructs.Point()
                {
                    x = 0, y = 0, z = p.y
                };
                w = new Structs.BasicStructs.Point()
                {
                    x = p.y, y = 0, z = 0
                };
            }
            else //if (p.z != 0)
            {
                v = new Structs.BasicStructs.Point()
                {
                    x = p.z, y = 0, z = 0
                };
                w = new Structs.BasicStructs.Point()
                {
                    x = 0, y = p.z, z = 0
                };
            }


            //Sorteio do movimento para 4 possibilidades (de 0 à 3)
            Randomic.Random();
            int i = (int)(Randomic.randu * 4);

            end type = end.none;

            switch (i)
            {
            case 0:
                //Primeira possibilidade: r1=r2+vi
                r1.x = r2.x + v.x;
                r1.y = r2.y + v.y;
                r1.z = r2.z + v.z;
                type = end.one;
                break;

            case 1:
                //Segunda possibilidade: r1=r2-vi
                r1.x = r2.x - v.x;
                r1.y = r2.y - v.y;
                r1.z = r2.z - v.z;
                type = end.two;
                break;

            case 2:
                //Terceira possibilidade: r1=r2+wi
                r1.x = r2.x + w.x;
                r1.y = r2.y + w.y;
                r1.z = r2.z + w.z;
                type = end.three;
                break;

            case 3:
                //Quarta possibilidade: r1=r2-wi
                r1.x = r2.x - w.x;
                r1.y = r2.y - w.y;
                r1.z = r2.z - w.z;
                type = end.four;
                break;

            default:
                new GridProteinFolding.Middle.Helpers.LoggingHelpers.Log().Exception(new System.Exception("Error ends.."), Types.ErrorLevel.Warning);
                break;
            }

            //GICO.WriteLine("{0} {1} {2}", r1.x, r1.y, r1.z);

            //Verifica a aceitação do movimento
            if (TryMove(ref r1)) // && TryMovePeerDPP(ref pointSorted, (Structs.Point)Members.monomero.r[neighborNode]))
            {
                GCPS.tempChain.r[GCPS.chain.selectNode] = r1;
                GCPS.tempChain.contMoves.endsAccept++;

                switch (type)
                {
                case end.one:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_1++;
                    break;

                case end.two:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_2++;
                    break;

                case end.three:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_3++;
                    break;

                case end.four:
                    GCPS.tempChain.contMoves.moveSetEnd.endAccept_4++;
                    break;
                }

                GCPS.tempChain.typeOfLattice = BasicEnums.Lattices.End;

                return(true);
            }
            else
            {
                GCPS.chain.contMoves.endsReject++;

                switch (type)
                {
                case end.one:
                    GCPS.chain.contMoves.moveSetEnd.endReject_1++;
                    break;

                case end.two:
                    GCPS.chain.contMoves.moveSetEnd.endReject_2++;
                    break;

                case end.three:
                    GCPS.chain.contMoves.moveSetEnd.endReject_3++;
                    break;

                case end.four:
                    GCPS.chain.contMoves.moveSetEnd.endReject_4++;
                    break;
                }
                return(false);
            }
        }