Example #1
0
class NoticeCouldMakeTimes(LateNoticer):
    min_support_for = 1.0
    acs = [
        OrBlock(
            LookForTup(
                [
                    And(CTagged(Avail), MinActivation(3.0)),
                    And(CTagged(Avail), MinActivation(3.0))
                ],
                tupcond=NotTheArgsOf(Times, 'source'),
                focal_point=InWorkspace,
            ), NeedOperands.from_env()),
        BuildOpResult(Times, operands='nodes')
    ]
Example #2
0
class AddAllInGlom(AcNode):
    threshold = 1.0
    acs = [
        All(And(OfClass(Number), CTagged(Avail))),
        WithNameOverride(LookFor(And(OfClass(Plus), CTagged(Allowed)),
                                 focal_point=InWorkspace),
                         focal_point='opwithin'),
        AddNode(
            Proposal,
            action=ConsumeOperands(),
            proposed_operands='nodes',
            proposed_operator='node',
        )
    ]
Example #3
0
class OoMTagger(Nonstop, AcNode):
    initial_activation = 5.0
    acs = [
        LookForTup(And(Number, NotTagged(OoM)), focal_point=InWorkspace),
        LogValue(),
        AddNode(OoM, taggees='nodes', value='value')
    ]
Example #4
0
 def go(self, g, actor):
     if g.has_neighbor_at(actor, 'basis'):
         raise Fizzle('already has basis')
     archetypal_basis = g.neighbor(actor, 'need_basis_like')
     if not archetypal_basis:
         raise UnexpectedFizzle('no archetypal_basis')
     focal_point = g.neighbors(actor, 'focal_point')
     if not focal_point:
         #raise UnexpectedFizzle('no focal_point')
         focal_point = actor
     #basis = g.look_for(g.as_node(archetypal_basis), focal_point=focal_point)
     basis = g.look_for(
         # HACK!! Should not 'see' Operator nodes that aren't linked in
         # some way analogous to the archetypal_basis.
         And(g.as_node(archetypal_basis), NotTagged('Allowed')),
         focal_point=focal_point
     )
     if basis:
         g.add_edge(actor, 'basis', basis, 'basis_of')
         g.wake(actor)
     else:
         # TODO FizzleAndBlock, making an active node that tries to create
         # the missing basis.
         g.sleep(actor)
         raise Fizzle('could not find basis')
Example #5
0
class NoticeCouldMakeMinus(AcNode):
    min_support_for = 1.0
    acs = [
        OrBlock(
            LookForTup(
                [
                    And(CTagged(Avail), MinActivation(0.0)),
                    And(CTagged(Avail), MinActivation(0.0))
                ],
                tupcond=CTupAnd(NotTheArgsOf(Minus, 'source'), GreaterThan()),
                focal_point=InWorkspace,
            ), NeedOperands.from_env()),
        DeTup(asgn_to=('minuend', 'subtrahend')),
        BuildOpResult(Minus,
                      minuend='minuend',
                      subtrahend='subtrahend',
                      completion_of='this')
    ]
Example #6
0
class OoMBigGapToWantedTagger(Persistent, AcNode):
    acs = [
        LookForTup([And(CTagged(OoM), CTagged(Want)),
                    CTagged(OoM)],
                   tupcond=CTupAnd(NotTheArgsOf(OoMBigGapToWanted, 'taggees'),
                                   TagValuesBigGap(OoM)),
                   focal_point=InWorkspace),
        DeTup(asgn_to=('node1', 'node2')),
        AddNode(OoMBigGapToWanted, wanted='node1', lesser='node2')
    ]