Preparing for refactor
This commit is contained in:
233203
copycat.log
233203
copycat.log
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user