Preparing for refactor

This commit is contained in:
Alexandre Linhares
2017-09-27 20:00:02 -03:00
parent 120aa3a293
commit a564e43dff
2 changed files with 57964 additions and 175306 deletions

233203
copycat.log

File diff suppressed because it is too large Load Diff

View File

@ -155,8 +155,7 @@ def breaker(ctx, codelet):
def chooseRelevantDescriptionByActivation(ctx, workspaceObject): def chooseRelevantDescriptionByActivation(ctx, workspaceObject):
random = ctx.random random = ctx.random
descriptions = workspaceObject.relevantDescriptions() descriptions = workspaceObject.relevantDescriptions()
weights = [description.descriptor.activation weights = [description.descriptor.activation for description in descriptions]
for description in descriptions]
return random.weighted_choice(descriptions, weights) return random.weighted_choice(descriptions, weights)
@ -401,8 +400,8 @@ def replacement_finder(ctx, codelet):
relation = relations[diff] relation = relations[diff]
else: else:
relation = None relation = None
letterOfInitialString.replacement = Replacement(ctx, letterOfInitialString.replacement = Replacement(ctx, letterOfInitialString,
letterOfInitialString, letterOfModifiedString, relation) letterOfModifiedString, relation)
if relation != slipnet.sameness: if relation != slipnet.sameness:
letterOfInitialString.changed = True letterOfInitialString.changed = True
workspace.changedObject = letterOfInitialString workspace.changedObject = letterOfInitialString
@ -445,8 +444,8 @@ def top_down_bond_scout__direction(ctx, codelet):
coderack = ctx.coderack coderack = ctx.coderack
slipnet = ctx.slipnet slipnet = ctx.slipnet
direction = codelet.arguments[0] direction = codelet.arguments[0]
source = __getScoutSource(ctx, source = __getScoutSource(ctx, direction, formulas.localDirectionCategoryRelevance,
direction, formulas.localDirectionCategoryRelevance, 'bond') 'bond')
destination = chooseDirectedNeighbor(ctx, source, direction) destination = chooseDirectedNeighbor(ctx, source, direction)
assert destination assert destination
logging.info('to object: %s', destination) logging.info('to object: %s', destination)
@ -471,7 +470,7 @@ def bond_strength_tester(ctx, codelet):
__showWhichStringObjectIsFrom(bond) __showWhichStringObjectIsFrom(bond)
bond.updateStrength() bond.updateStrength()
strength = bond.totalStrength strength = bond.totalStrength
#Todo: use entropy # TODO: use entropy
probability = temperature.getAdjustedProbability(strength / 100.0) probability = temperature.getAdjustedProbability(strength / 100.0)
logging.info('bond strength = %d for %s', strength, bond) logging.info('bond strength = %d for %s', strength, bond)
assert random.coinFlip(probability) assert random.coinFlip(probability)