public bool TryNextPermutation() {
bool allPermutationsHaveBeenTried = true;
if (this.currentWildGuesses != null) {
var keys = new List<uint>(this.currentWildGuesses.Keys);
foreach (var key in keys) {
var oldValue = this.currentWildGuesses[key];
if (oldValue == 4)
this.currentWildGuesses[key] = 1;
else if (oldValue == 1)
this.currentWildGuesses[key] = 2;
else if (oldValue == 2)
this.currentWildGuesses[key] = 8;
else {
this.currentWildGuesses[key] = 4;
continue;
}
allPermutationsHaveBeenTried = false;
break;
}
}
if (allPermutationsHaveBeenTried && this.currentGoodGuesses != null) {
if (this.currentWildGuesses == null) this.currentWildGuesses = new Dictionary<uint, byte>();
foreach (var key in this.currentGoodGuesses.Keys) {
allPermutationsHaveBeenTried = false;
this.currentWildGuesses[key] = 4;
}
this.currentGoodGuesses = null;
}
return !allPermutationsHaveBeenTried;
}