public HuntAndKillMazeAlgorithm(Cell[,] mapCells, int PRNGSeed)
 {
     cells           = mapCells;
     rows            = mapCells.GetLength(0);
     columns         = mapCells.GetLength(1);
     numberGenerator = new PseudoRandomNumberGenerator(PRNGSeed);
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        particleSystemPool = GameObject.FindGameObjectWithTag("MapLoader").GetComponent <ParticleSystemPool>();
        numberGenerator    = new PseudoRandomNumberGenerator(StaticGameStats.Seed);
        Initialize();
        HuntAndKillMazeAlgorithm ma = new HuntAndKillMazeAlgorithm(cells, StaticGameStats.Seed);

        ma.CreateMap();
    }
Ejemplo n.º 3
0
        private static void WorkWithStaticTypes()
        {
            PseudoRandomNumberGenerator.GetClassName();

            for (int i = 0; i < 100; i++)
            {
                System.Console.WriteLine(PseudoRandomNumberGenerator.Next());
            }
        }
 public void Reset()
 {
     Prng       = new PseudoRandomNumberGenerator(0);
     UpdateMesh = false;
     Hull.Reset();
     HullData.Faces       = null;
     HullData.VertexFaces = null;
     GetComponent <MeshFilter>().sharedMesh = new UnityEngine.Mesh();
 }
Ejemplo n.º 5
0
        public virtual void Shuffle()
        {
            PseudoRandomNumberGenerator r = new PseudoRandomNumberGenerator();

            // iterate through each catalogue item performing arbitrary swaps
            if (Count > 1)
            {
                for (int item = 0; item < Count; item++)
                {
                    int nArbitrary = r.Next(0, Count - 1);

                    PlayListItem anItem = _listPlayListItems[nArbitrary];
                    _listPlayListItems[nArbitrary] = _listPlayListItems[item];
                    _listPlayListItems[item]       = anItem;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Расшифрование гаммированием
        /// </summary>
        /// <param name="input">Расшифруемая строка</param>
        /// <param name="key">Ключ расшифрования</param>
        /// <returns>Возвращает расшифрованный текст</returns>
        public static string Decode(string input, int key)
        {
            int A = new PseudoRandomNumberGenerator().A,
                B = new PseudoRandomNumberGenerator().B,
                m = new PseudoRandomNumberGenerator().M;


            string txt = "";

            if (Mathematics.GCD(B, m) == 1)
            {
                foreach (char element in input.ToCharArray())
                {
                    txt += GammaCipherDecode(element, key);
                    key  = (key * A + B) % m;
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Ошибка: \nНОД = " + Mathematics.GCD(B, m), "Ошибка");
            }

            return(txt);
        }