Exemple #1
0
        // Similar to the above tests, but tests many possible bit sizes
        public int[] testSpecialException()
        {
            int[] passed = new int[2];
            passed[1] = 4;

            string seed4 = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
            string seed1 = "52BE1E391AF51C8794E37CD3FEC3054D1";
            string seed2 = "6C87DDE23A0F865E087A4DDF2A7A6077A";
            string seed3 = "D159F42FE7DEE8161FDEE3BEF50C63F93";

            int[] actions1 = seedToByte.getActions(seed1);
            int[] actions2 = seedToByte.getActions(seed2);
            int[] actions3 = seedToByte.getActions(seed3);
            int[] actions4 = seedToByte.getActions(seed4);

            string final1 = seedToByte.getSeed(actions1);
            string final2 = seedToByte.getSeed(actions2);
            string final3 = seedToByte.getSeed(actions3);
            string final4 = seedToByte.getSeed(actions4);

            if (seed1 == final1)
            {
                passed[0] += 1;
            }
            else
            {
                Debug.Log("Test for seed: " + seed1 + " failed. final: " + final1);
            }
            if (seed2 == final2)
            {
                passed[0] += 1;
            }
            else
            {
                Debug.Log("Test for seed: " + seed2 + " failed. final: " + final2);
            }
            if (seed3 == final3)
            {
                passed[0] += 1;
            }
            else
            {
                Debug.Log("Test for seed: " + seed3 + " failed. final: " + final3);
            }
            if (seed4 == final4)
            {
                passed[0] += 1;
            }
            else
            {
                Debug.Log("Test for seed: " + seed4 + " failed. final: " + final4);
            }



            return(passed);
        }
        /// <summary>
        /// Returns list of Interactable IDs generated from encoding a seed string into
        /// a series of interactable actions.
        /// </summary>
        public InteractableID[] getPathIDs(string seedString)
        {
            int[] actions = converter.getActions(seedString);
            List <InteractableID> locationIDs = new List <InteractableID>();

            int count = 0;

            while (count < actions.Length)
            {
                int siteID = actions[count];

                for (int j = 0; j < InteractableConfig.ActionsPerSite; j++)
                {
                    int spotID   = actions[count + (2 * j) + 1];
                    int actionID = actions[count + (2 * j) + 2];
                    locationIDs.Add(new InteractableID(siteID, spotID, actionID));
                }

                count += 1 + 2 * InteractableConfig.ActionsPerSite;
            }

            return(locationIDs.ToArray());
        }