Exemplo n.º 1
0
 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))
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 def AddAttempt(self, change):
     assert change in self._attempts
     self._attempts[change].append(
         attempt_module.Attempt(self._quests, change))
Exemplo n.º 6
0
 def AddChange(self, change):
     self._changes.append(change)
     self._attempts[change] = [attempt_module.Attempt(self._quests, change)]