def teest_see_do3(self): g = TestGraph() prog = ''' Scout => 111 # This is actually crazy and FARGish shouldn't allow it ''' make_python(prog, debug=True) #DEBUG '''
def teest_see_do2(self): g = TestGraph() prog = ''' Scout => predefined_action ''' make_python(prog, debug=True) #DEBUG '''
def teest_see_do1(self): g = TestGraph() prog = ''' Scout => do_something() ''' make_python(prog, debug=True) #DEBUG '''
def teest_see_do4(self): g = TestGraph() prog = ''' goal -- tags SuccessScout(goal) Scout => build SuccessScout(goal=this) ''' make_python(prog, debug=True) #DEBUG '''
def teest_see_do(self): g = TestGraph() prog = ''' tags -- taggees Tag Found, Done, SomethingElse : Tag Target Simplest => do_something() Builder => build ConsumeOperands(1, 2, 3) Scout see t := NodeOfClass(Target) => add_tag(Found, t) Scout2 see Not(Tagged(Done, this)) => do_something(this) Scout3 see t1 := NodeOfClass(Target) => add_tag(Found, t1) else see t2 := NodeOfClass(Found) => add_tag(Done, t2) Scout4 see t1 := NodeOfClass(Target) => add_tag(Found, t1) else see t2 := NodeOfClass(Found) => add_tag(Done, t2) else see t3 := NodeOfClass(SomethingElse) => do_something(Found, t2, t3) ''' make_python(prog) #DEBUG
OperandTagger see node := NodeOfClass((Brick, Block)) => build CouldBeOperand(node) ConsumeOperands OperandsScout(target) see p1 := NodeWithTag(Number, Avail), p2 := NodeWithTag(Number, Avail), op := NodeWithTag(Operator, Allowed) => build ConsumeOperands(op, p1, p2) else see block := NodeWithTag(Block, Avail), block != target => Fail(block) ''' make_python(prog, debug=1) exec(compile_fargish(prog), globals()) Numble = make_numble_class(Brick, Target, Want, Avail, Allowed, [Plus, Times, Minus]) ##### Hacks tag_port_label = 'taggees' taggee_port_label = 'tags' @classmethod def cls_add_tag(cls, g, taggees): # HACK taggees = list(as_iter(taggees)) taggee_containers = intersection(