feature-allow-words-reuse
Inga 🏳‍🌈 8 years ago
parent 6989f478d9
commit f1c8e276a2
  1. 9
      WhiteRabbit/Program.cs
  2. 7
      WhiteRabbit/VectorsProcessor.cs

@ -53,13 +53,14 @@
sourceChars == ToOrderedChars(Encoding.ASCII.GetString(phraseBytes)), sourceChars == ToOrderedChars(Encoding.ASCII.GetString(phraseBytes)),
$"StringsProcessor produced incorrect anagram: {Encoding.ASCII.GetString(phraseBytes)}"); $"StringsProcessor produced incorrect anagram: {Encoding.ASCII.GetString(phraseBytes)}");
var hashVector = ComputeHashVector(phraseBytes); Console.WriteLine(Encoding.ASCII.GetString(phraseBytes));
/*var hashVector = ComputeHashVector(phraseBytes);
if (Array.IndexOf(expectedHashesAsVectors, hashVector) >= 0) if (Array.IndexOf(expectedHashesAsVectors, hashVector) >= 0)
{ {
var phrase = Encoding.ASCII.GetString(phraseBytes); var phrase = Encoding.ASCII.GetString(phraseBytes);
var hash = VectorToHexadecimalString(hashVector); var hash = VectorToHexadecimalString(hashVector);
Console.WriteLine($"Found phrase for {hash}: {phrase}; time from start is {stopwatch.Elapsed}"); Console.WriteLine($"Found phrase for {hash}: {phrase}; time from start is {stopwatch.Elapsed}");
} }*/
#if DEBUG #if DEBUG
anagramsBag.Add(Encoding.ASCII.GetString(phraseBytes)); anagramsBag.Add(Encoding.ASCII.GetString(phraseBytes));
@ -115,6 +116,10 @@
string line; string line;
while ((line = Console.ReadLine()) != null) while ((line = Console.ReadLine()) != null)
{ {
if (line.Length == 1 && line != "a" && line != "i")
{
continue;
}
yield return Encoding.ASCII.GetBytes(line); yield return Encoding.ASCII.GetBytes(line);
} }
} }

@ -106,7 +106,7 @@
var currentVectorInfo = dictionary[i]; var currentVectorInfo = dictionary[i];
if (currentVectorInfo.Vector == remainder) if (currentVectorInfo.Vector == remainder)
{ {
yield return ImmutableStack.Create(currentVectorInfo.Index); //yield return ImmutableStack.Create(currentVectorInfo.Index);
} }
else if (currentVectorInfo.Norm < requiredRemainderPerWord) else if (currentVectorInfo.Norm < requiredRemainderPerWord)
{ {
@ -190,6 +190,9 @@
private static IEnumerable<T[]> GeneratePermutations<T>(T[] original) private static IEnumerable<T[]> GeneratePermutations<T>(T[] original)
{ {
yield return original;
yield break;
/*
var length = original.Length; var length = original.Length;
foreach (var permutation in PrecomputedPermutationsGenerator.HamiltonianPermutations(length)) foreach (var permutation in PrecomputedPermutationsGenerator.HamiltonianPermutations(length))
{ {
@ -200,7 +203,7 @@
} }
yield return result; yield return result;
} }*/
} }
private struct VectorInfo private struct VectorInfo

Loading…
Cancel
Save