Demagic everything in formulas.py. NFC.
Only one file left to go!
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import math
|
||||
import logging
|
||||
import random
|
||||
|
||||
from conceptMapping import ConceptMapping
|
||||
@ -43,23 +42,6 @@ def blur(value):
|
||||
return value - root
|
||||
|
||||
|
||||
def chooseObjectFromList(objects, attribute):
|
||||
from context import context as ctx
|
||||
temperature = ctx.temperature
|
||||
if not objects:
|
||||
return None
|
||||
probabilities = []
|
||||
for objekt in objects:
|
||||
value = getattr(objekt, attribute)
|
||||
probability = temperature.getAdjustedValue(value)
|
||||
logging.info('Object: %s, value: %d, probability: %d',
|
||||
objekt, value, probability)
|
||||
probabilities += [probability]
|
||||
i = selectListPosition(probabilities)
|
||||
logging.info('Selected: %d', i)
|
||||
return objects[i]
|
||||
|
||||
|
||||
def chooseRelevantDescriptionByActivation(workspaceObject):
|
||||
descriptions = workspaceObject.relevantDescriptions()
|
||||
if not descriptions:
|
||||
|
||||
Reference in New Issue
Block a user