def AddAttempts(self, change): assert change in self._attempts attempt_count = min(_REPEAT_COUNT_INCREASE, _MAX_REPEAT_COUNT - len(self._attempts[change])) for _ in xrange(attempt_count): self._attempts[change].append( attempt_module.Attempt(self._quests, change))
def AddAttempts(self, change): if not hasattr(self, '_pin'): # TODO: Remove after data migration. self._pin = None if self._pin: change = change.Update(self._pin) for _ in xrange(_REPEAT_COUNT_INCREASE): attempt = attempt_module.Attempt(self._quests, change) self._attempts[change].append(attempt)
def AddAttempts(self, change): if not hasattr(self, '_pin'): # TODO: Remove after data migration. self._pin = None if self._pin: change_with_pin = change.Update(self._pin) else: change_with_pin = change # This algorithm will double the number of attempts, to allow us to get # more attempts sooner and getting to better statistical decisions with # less iterations. current_attempt_count = max(len(self._attempts[change]), MIN_ATTEMPTS) it = 0 while it != current_attempt_count: attempt = attempt_module.Attempt(self._quests, change_with_pin) self._attempts[change].append(attempt) it += 1
def AddAttempts(self, change): assert change in self._attempts for _ in xrange(_REPEAT_COUNT_INCREASE): self._attempts[change].append( attempt_module.Attempt(self._quests, change))
def AddAttempt(self, change): assert change in self._attempts self._attempts[change].append( attempt_module.Attempt(self._quests, change))
def AddChange(self, change): self._changes.append(change) self._attempts[change] = [attempt_module.Attempt(self._quests, change)]