예제 #1
0
        public string Decrypt()
        {
            //it is likely faster to construct words based on length and repeat letters before considering word options
            words.Sort((a, b) => a.GetLength().CompareTo(b.GetLength()));

            foreach (Word word in words)
            {
                foreach (Artifact a in word) //length of the alphabet isn't changing. right? (punctuation, capitals)
                {
                    Artifact actual  = UniqueArtifacts.GetUniqueArtifact(a.getID());
                    char     current = actual.Letter();
                    for (int i = 0; i < actual.getLength(); i++)
                    {
                        if (dictionary.Contains(word.Compound())) //only 1 exact match for each word should exist
                        {
                            word.AddPotentialMeaning(word.Compound());
                            current = actual.Next();
                        }
                        else
                        {
                            current = actual.NextDestructive();
                        }
                    }
                }
            }
            return(" ");
        }
예제 #2
0
 public Word(List <int> m_ids)
 {
     foreach (int id in m_ids)
     {
         word.Add(UniqueArtifacts.GetUniqueArtifact(id));
     }
 }
예제 #3
0
        private void InitializeUniqueArtifacts(List <List <int> > content_ids)
        {
            //differentiate unique IDs and establish structure of unknown letters
            List <int> unique_ids = new List <int>();

            foreach (List <int> word in content_ids)
            {
                foreach (int letter in word)
                {
                    if (!unique_ids.Contains(letter)) //numbers is a list of unique IDs
                    {
                        unique_ids.Add(letter);
                    }
                }
            }
            UniqueArtifacts.SetUniqueArtifacts(unique_ids);
        }