no checks is faster than all checks :(
This commit is contained in:
parent
532b1cb85f
commit
d5a771ff14
@ -17,7 +17,9 @@ class CounterSkip(size: Int): Counter(size, 18) {
|
||||
var last = super.increase()
|
||||
lmi = min(lastModifiedIndex, lmi)
|
||||
// are we having an invalid situation? this would be two consecutive moves on the same face
|
||||
while (containsConsecutiveSameFaceMoves() && !atMax()) {
|
||||
while (
|
||||
(containsConsecutiveSameFaceMoves() && !atMax()) ||
|
||||
(this.counter?.size > 1 && !atMax() && containsPalindrome())) {
|
||||
last = super.increase()
|
||||
lmi = min(lastModifiedIndex, lmi)
|
||||
}
|
||||
@ -26,6 +28,15 @@ class CounterSkip(size: Int): Counter(size, 18) {
|
||||
return last
|
||||
}
|
||||
|
||||
private fun containsPalindrome(): Boolean {
|
||||
val i1 = this.counter.size / 2
|
||||
for (i in 0 until i1) {
|
||||
if (this.counter[i] != this.counter[this.counter.size - 1 - i])
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Are there two moves in the current counter / chain that act on the same face? This would be F+F2 for example.
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user