Beispiel #1
0
        private static IEnumerable <Tuple <SolveInstance, string> > Unencrypt(SolveInstance si, String encrypted)
        {
            //get all possible words of this length
            List <string> okstrs = DictionaryWords.Where((a, b) => si.Compare(a, encrypted)).ToList();

            if (okstrs.Count == 0)
            {
                yield break;
            }

            foreach (var s in okstrs)
            {
                var si2 = si.Clone();
                var ok  = si2.CompareChange(s, encrypted);

                if (ok == false)
                {
                    continue;
                }

                si2.SolvedStrings[encrypted] = s;

                yield return(new Tuple <SolveInstance, string>(si2, s));
            }
        }
Beispiel #2
0
        private static IEnumerable<Tuple<SolveInstance, string>> Unencrypt(SolveInstance si, String encrypted)
        {
            //get all possible words of this length
            List<string> okstrs = DictionaryWords.Where((a, b) => si.Compare(a, encrypted)).ToList();

            if (okstrs.Count == 0)
                yield break;

            foreach (var s in okstrs)
            {
                var si2 = si.Clone();
                var ok = si2.CompareChange(s, encrypted);

                if (ok == false)
                    continue;

                si2.SolvedStrings[encrypted] = s;

                yield return new Tuple<SolveInstance, string>(si2, s);
            }
        }