focus.set("goal:pizza object:dough")

    def dough(focus="goal:pizza object:dough"):  # if focus buffer has this chunk then....
        print "I have made a round piece of dough"  # print
        focus.set("goal:pizza object:cheese")  # change chunk in focus buffer

    def cheese(focus="goal:pizza object:cheese"):  # the rest of the productions are the same
        print "I have put cheese on the dough"  # but carry out different actions
        focus.set("goal:pizza object:ham")

    def chicken(focus="goal:pizza object:ham"):
        print "I have put chicken on the cheese"
        focus.set("goal:pizza object:sauce")

    def sauce(focus="goal:pizza object:cheese"):
        print "I have put sauce on the chicken"
        print "I have made a chicken and cheese pizza"
        focus.set("goal:stop")

    def stop_production(focus="goal:stop"):
        self.stop()  # stop the agent


tim = MyAgent()  # name the agent
pizzashop = MyEnvironment()  # name the environment
pizzashop.agent = tim  # put the agent in the environment
ccm.log_everything(pizzashop)  # print out what happens in the environment

pizzashop.run()  # run the environment
ccm.finished()  # stop the environment
Exemple #2
0
        focus.set('new_trial')
		
    def no_prime(focus='prime'):    #use counter
        print "reveal the problem"
        motor.reveal_operator()
        motor.reveal_numbers()
        focus.set('new_trial')

    def numbers_prime(focus='prime'):    #use counter
        print "reveal the numbers"
        motor.reveal_numbers()
        focus.set('operator_late')
        
    def operator_late(focus='operator_late', numbers='visible:yes', operator='visible:no'):
    	print "complete the problem with the operator"
    	motor.reveal_operator()
    	focus.set('new_trial')

	

Ppt=Participant()
Experimenter=Referee()
env=Arithmetic()
env.agent1=Ppt
env.agent2=Experimenter

#ccm.log_everything(env)

env.run(4)
ccm.finished()
Exemple #3
0
        b_focus.set('change_state')
        motor.motor_finst_reset()
        print 'I have exposed ', target

    def cut_wire(b_method='method:cut_wire target:?target state:running',
                 b_focus='change_state'):  # target is the chunk to be altered
        motor.change_state(target, "cut")
        b_method.set('method:change_state target:?target state:running')
        b_operator.set('operator:cut target:?target state:running')
        b_focus.set('cutting_wire')
        print 'cut wire'
        print 'target object = ', target

    def wire_cut(b_method='method:?method target:?target state:running',
                 motor_finst='state:finished',
                 b_focus='cutting_wire'):
        b_method.set('method:?method target:?target state:finished')
        motor.motor_finst_reset()
        b_focus.set('wire_is_cut')
        print 'I have cut ', target


############## run model #############

tim = MyAgent()  # name the agent
subway = MyEnvironment()  # name the environment
subway.agent = tim  # put the agent in the environment
ccm.log_everything(subway)  # print out what happens in the environment
subway.run()  # run the environment
ccm.finished()  # stop the environment
Exemple #4
0
    def Problem(focus='no coffee filters'):
        print "No coffee filters ... what is the best subsitute filter?"
        print "I'm search for knowledge  ..."
        DM.request('substitute_filter:?')  # KNOWLEDGE REQUEST
        focus.set('next')

    def Remember(focus='next',
                 DMbuffer='substitute_filter:?substitute_filter'):
        print " "
        print "I recall a good substitute filter is a ..."
        print substitute_filter
        # here there is no "focus.set" - the next production fires off the retrieved knowledge chunk (above) which then triggers the production below.

    def Finished(
        focus='strainer used'
    ):  # this is cued by production above tited "Fires_Off_Knowledge_Chunk" (above)
        print " "  # this demonstrates how knowledge serves as a buffer condition that triggers the next productions
        motor.finish_coffee()
        print "The coffee is finished."
        self.stop()


Julian = MyAgent()
env = MyEnvironment()
env.agent = Julian
# ccm.log_everything(env)

env.run()
ccm.finished()
 def shutdown(self) -> str:
     ccm.finished()
     return "The result of CmuActrModel:shutdown()"