class OpponentScreen_switch(ccm.Model):

    scissors = ccm.Model(isa='word', type='scissors', salience= 10)
    #update Rock
    rock = ccm.Model(isa='word', type='rock', salience= 10)
    #update paper
    paper = ccm.Model(isa='word', type='paper', salience= .1)
示例#2
0
class Subway(ccm.Model):        # items in the environment look and act like chunks - but note the syntactic differences
    bread=ccm.Model(isa='bread',location='on_counter')
    cheese=ccm.Model(isa='cheese',location='on_counter')
    ham=ccm.Model(isa='ham',location='on_counter')
    bread_top=ccm.Model(isa='bread_top',location='on_counter')

    sue_voice=ccm.Model(isa='voice',message='none')      # sounds are part of the environment
示例#3
0
class hyrule(ccm.Model):

    ### objects for task preformance
    response = ccm.Model(isa='response', state='state')
    display = ccm.Model(isa='diplay', state='RP')
    response_entered = ccm.Model(isa='response_entered', state='no')
    vision_finst = ccm.Model(isa='motor_finst', state='re_set')
class MyEnvironment(ccm.Model):

    red_wire = ccm.Model(isa='wire', state='uncut', salience=0.99)
    blue_wire = ccm.Model(isa='wire', state='uncut', salience=0.99)
    warning_light = ccm.Model(isa='warning_light', state='off', salience=0.99)

    motor_finst = ccm.Model(isa='motor_finst', state='re_set')
示例#5
0
class MyEnvironment(ccm.Model):

    red_wire = ccm.Model(isa='wire', state='uncut', color='red', salience=0.99)
    blue_wire = ccm.Model(isa='wire', state='uncut', color='blue', salience=0.99)
    green_wire = ccm.Model(isa='wire', state='uncut', color='green', salience=0.99)

    motor_finst = ccm.Model(isa='motor_finst', state='re_set')
class Subway(
        ccm.Model
):  # items in the environment look and act like chunks - but note the syntactic differences
    bread = ccm.Model(isa='bread', location='on_counter')
    cheese = ccm.Model(isa='cheese', location='on_counter')
    ham = ccm.Model(isa='ham', location='on_counter')
    bread_top = ccm.Model(isa='bread_top', location='on_counter')
示例#7
0
class Sock_drawer(ccm.Model):
    sock1 = ccm.Model(isa='sock',
                      location='in_drawer',
                      feature1='red_stripe',
                      salience=0.5)
    sock2 = ccm.Model(isa='sock',
                      location='in_drawer',
                      feature1='blue_stripe',
                      salience=0.5)
示例#8
0
class MyEnvironment(ccm.Model):

    response = ccm.Model(isa='response', state='none', salience=0.99)
    display = ccm.Model(isa='display', state='structura', salience=0.99)
    response_entered = ccm.Model(isa='response_entered',
                                 state='no',
                                 salience=0.99)

    motor_finst = ccm.Model(isa='motor_finst', state='re_set')
示例#9
0
class MyEnvironment(ccm.Model):

    warning_light = ccm.Model(isa='warning_light', state='off')
    response = ccm.Model(isa='response', state='none')
    code = ccm.Model(
        isa='code', state='SU'
    )  # model assumes it starts at AK and doen't look until it has to

    motor_finst = ccm.Model(isa='motor_finst', state='re_set')
示例#10
0
class MyEnvironment(ccm.Model):
    coffee = ccm.Model(isa='coffee',
                       location='in_kitchen',
                       state='unmade',
                       filter='none')
    strainer = ccm.Model(isa='stainer', location='in_drawer', state='unused')
    cheese_cloth = ccm.Model(isa='cheese_cloth',
                             location='in_drawer',
                             state='unused')
示例#11
0
class RockPaperScissors(ccm.Model):
    choice1 = RPSChoice(x=0.5,
                        y=0.2,
                        instructions='Choose: Rock(1) Paper(2) Scissors(3)')
    choice2 = RPSChoice(x=0.5,
                        y=0.8,
                        instructions='Choose: Rock(Z) Paper(X) Scissors(C)')

    result = ccm.Model(x=0.5, y=0.5, visible=False)

    score1 = ccm.Model(text=0, x=0.9, y=0.1)
    score2 = ccm.Model(text=0, x=0.9, y=0.9)

    trials = 0

    def key_pressed(self, key):
        if key == '1': self.choice1.choose('rock')
        if key == '2': self.choice1.choose('paper')
        if key == '3': self.choice1.choose('scissors')

        if key == 'z': self.choice2.choose('rock')
        if key == 'x': self.choice2.choose('paper')
        if key == 'c': self.choice2.choose('scissors')

    def determine_winner(self):
        self.choice1.text = self.choice1.choice
        self.choice2.text = self.choice2.choice
        self.choice1.visible = True
        self.choice2.visible = True

        c1 = self.choice1.choice
        c2 = self.choice2.choice
        if c1 == c2:
            self.result.text = "Tie!"
        elif (c1 == 'rock' and c2 == 'scissors') or (
                c1 == 'paper' and c2 == 'rock') or (c1 == 'scissors'
                                                    and c2 == 'paper'):
            self.result.text = "Player 1 wins!"
            self.score1.text += 1
        else:
            self.result.text = "Player 2 wins!"
            self.score2.text += 1
        self.result.visible = True

        yield 1

        self.result.visible = False

        self.choice1.reset()
        self.choice2.reset()

        self.trials += 1
        if self.trials >= 100:
            log.score1 = self.score1.text
            log.score2 = self.score2.text
            self.stop()
示例#12
0
class In_cockpit(ccm.Model):
    procedure1 = ccm.Model(
        isa='pilot_procedure',
        location='landing_phase',
        feature1='notice_incursion',
        salience=0.5
    )  # you can change the salience and see which productions fire
    procedure2 = ccm.Model(isa='pilot_procedure',
                           location='landing_phase',
                           feature1='recall_runway',
                           salience=0.5)
示例#13
0
class PairedExperiment(ccm.Model):
    word = ccm.Model(visible=False, x=0.5, y=0.5, font='Arial 20', type='Text')
    number = ccm.Model(visible=False,
                       x=0.5,
                       y=0.5,
                       font='Arial 20',
                       type='Number')

    def start(self):
        pairs = [('bank', '0'), ('card', '1'), ('dart', '2'), ('face', '3'),
                 ('game', '4'), ('hand', '5'), ('jack', '6'), ('king', '7'),
                 ('lamb', '8'), ('mask', '9'), ('neck', '0'), ('pipe', '1'),
                 ('quip', '2'), ('rope', '3'), ('sock', '4'), ('tent', '5'),
                 ('vent', '6'), ('wall', '7'), ('xray', '8'), ('zinc', '9')]
        items = self.random.sample(pairs, size)
        scores = []
        times = []
        for i in range(trials):
            score = 0
            time = 0
            self.random.shuffle(items)
            for w, n in items:
                self.word.text = w
                self.word.visible = True
                start = self.now()
                self.key = None
                yield self.key_pressed, display_time
                self.word.visible = False

                if self.key == n:
                    score += 1
                    time += self.now() - start
                self.number.text = n
                self.number.visible = True
                yield display_time
                self.number.visible = False
            scores.append(score)
            times.append(time)
        for i in range(1, trials):
            log.score[i] = scores[i]
            if scores[i] > 0: times[i] = times[i] / scores[i]
            log.time[i] = times[i]

    def key_pressed(self, key):
        self.key = key
示例#14
0
class MyEnvironment(ccm.Model):
    display     = ccm.Model(word="START")
    
    # start presenting the list
    def start_list(self):
        times = [0.7090, 3.8111, 6.9672, 9.8382, 18.2230, 18.7200, 19.0000, 24.0890, 29.4293, 29.9843]
        print self.now()
        stimulus = "TEST"
        for time in times:
            yield max(time - self.now(),0)
            self.display.word = stimulus
        yield 30 - self.now()
        self.display.word = "OFF"
示例#15
0
class ForcedChoiceEnvironment(ccm.Model):
    trials = 0
    score = 0

    # make the buttons
    button1 = ccm.Model(letter='A', reward=1)
    button2 = ccm.Model(letter='B', reward=0)

    # make the display.  Initially it shows a reward of zero.
    display = ccm.Model(reward=0)

    def press(self, letter):
        if letter == self.button1.letter:
            self.display.reward = self.button1.reward
        elif letter == self.button2.letter:
            self.display.reward = self.button2.reward

        self.score = self.score + self.display.reward

        log.action = letter
        self.trials += 1
        if self.trials == 200: self.stop()
示例#16
0
class MyEnvironment(ccm.Model):

    response = ccm.Model(isa='response', state='none', salience=0.99)
    display = ccm.Model(isa='display', state='structura', salience=0.99)
    response_entered = ccm.Model(isa='response_entered',
                                 state='no',
                                 salience=0.99)

    blue_wire = ccm.Model(isa='wire', state='uncut', salience=0.99)
    green_wire = ccm.Model(isa='wire', state='uncut', salience=0.99)
    warning_light = ccm.Model(isa='warning_light', state='off', salience=0.99)

    motor_finst = ccm.Model(isa='motor_finst', state='re_set')
示例#17
0
 def __init__(self, buffer1, buffer2, delay=0.0, log=None, delay_sd=None):
     #from ccm.morserobots import middleware
     #self._vision_cam = Morse().robot.GeometricCamerav1
     self._b1 = buffer1
     self._b2 = buffer2
     self.delay = delay
     self.delay_sd = delay_sd
     self.error = False
     self.busy = False
     self._objects = {}
     self._openings = {}
     self._oldopenings = {}
     self._edges = {}
     self._internalChunks = []
     self._screenLeft = numpy.arange(Decimal(0.60), Decimal(1.0),
                                     Decimal(0.002))
     self._screenCenter = numpy.arange(Decimal(0.30), Decimal(0.60),
                                       Decimal(0.002))
     self._screenRight = numpy.arange(Decimal(0.0), Decimal(0.30),
                                      Decimal(0.002))
     self._internalChunks.append(ccm.Model(isa='dial'))
示例#18
0
文件: simple_list.py 项目: zizai/HDM
class MyEnvironment(ccm.Model):
    display = ccm.Model(word="START")
    report = [0] * 20

    # start present the list
    def start_list(self):
        stimuli = range(1, 21)
        stimuli = stimuli + ["END", "RECALL"]
        for stimulus in stimuli:
            yield 1
            self.display.word = "NONE"
            yield 1
            self.display.word = stimulus

    # turn off the display at the end of the experiment
    def end_experiment(self):
        self.display.word = "OFF"

    def report_word(self, word):
        if word != "START":
            if word != "END":
                self.report[int(word) - 1] = self.report[int(word) - 1] + 1
示例#19
0
class Environment(
        ccm.Model
):  # items in the environment look and act like chunks - but note the syntactic differences
    prepping_world = True

    while prepping_world:
        occupied_tally = 0
        squares = [ccm.Model(isa='square', x=x, y=y, occupied=0, occupant='nil') \
            for x in range(world_x_range) for y in range(world_y_range)]

        for square in squares:
            if (str(square.x), str(square.y)) == goal_square:
                square.occupied = 1
                square.occupant = 'goal'

        for square in squares:
            x = random.choice(range(10))
            if x == 3 and \
                (str(square.x), str(square.y)) != goal_square:
                square.occupant = 'monster'
                square.occupied = 1

            elif x == 2 and \
                (str(square.x), str(square.y)) != goal_square:
                square.occupant = 'bunny'
                square.occupied = 1

        for s in squares:
            if s.occupied == 1:
                occupied_tally += 1
        if occupied_tally + number_of_agents >= world_x_range * world_y_range:
            continue
        else:
            prepping_world = False

    agent_list = []
示例#20
0
文件: u2_match.py 项目: rlwest/Misc
 def start(self):
     self.count = 0
     yield 1  # wait one second
     self.letter = ccm.Model(isa='letter', x=0.5, y=0.5, visible=True)
     self.letter.text = self.random.choice('BCDFGHJKLMNPQRSTVWXYZ')
     self.target = self.letter.text
示例#21
0
class OpponentScreen(ccm.Model):
    rock = ccm.Model(isa='word', type='rock', salience= .1)
    paper = ccm.Model(isa='word', type='paper', salience= 10)
    scissors = ccm.Model(isa='word', type='scissors', salience= 10)
示例#22
0
    def __init__(self, buffer1, delay=0.0, log=None, delay_sd=None):
        self._b1 = buffer1
        #self._b2=buffer2
        self.delay = delay
        self.delay_sd = delay_sd
        self.error = False
        self.busy = False
        self._internalChunks = []
        self._boundingBox = []
        self.get_bounding_box()

        # self._monitor = MotorMonitor()
        #internal name  #external       #addition arguments for external
        self.function_map = {
            'rotate_torso': ['set_rotation', {
                'bone': 'ribs'
            }],
            'lower_arms': ['lower_arms', {}],
            'extend_shoulder': ['set_rotation', {
                'axis': 2
            }],
            'compress_shoulder': ['set_rotation', {
                'axis': 2
            }],
            'move_forward': ['move_forward', {}]
        }

        self._bones = self.get_bones()
        #NAME      #min/max by axis: 0, 1, 2
        self._boneProperties = {
            'part.torso': [[0, 0], [-pi / 4, pi / 4], [0, 0]],
            'shoulder.L': [[0, 0], [0, 0], [-pi / 6, pi / 6]],
            'shoulder.R': [[0, 0], [0, 0], [-pi / 6, pi / 6]]
        }
        #Tick
        self._internalChunks.append(
            ccm.Model(
                type='posture',
                standing='true',
                prone='no',
                minimal_width='false',
                walkable='true',
                runnable='true',
            ))
        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='shoulders_quality',
                      quality='none'))

        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='rotation',
                      bone='upper_arm.R',
                      rotation0='0.0',
                      rotation0_quality='none',
                      rotation1='0.0',
                      rotation1_quality='none',
                      rotation2='0.0',
                      rotation_2_quality='none',
                      overall_quality='none'))

        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='rotation',
                      bone='upper_arm.L',
                      rotation0='0.0',
                      rotation0_quality='none',
                      rotation1='0.0',
                      rotation1_quality='none',
                      rotation2='0.0',
                      rotation_2_quality='none',
                      overall_quality='none'))

        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='rotation',
                      bone='shoulder.R',
                      rotation0='0.0',
                      rotation0_quality='none',
                      rotation1='0.0',
                      rotation2='0.0',
                      rotation_quality='none'))

        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='rotation',
                      bone='shoulder.L',
                      rotation0='0.0',
                      rotation0_quality='none',
                      rotation1='0.0',
                      rotation2='0.0',
                      rotation_quality='none'))

        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='rotation',
                      bone='torso',
                      rotation0_quality='none',
                      rotation0_direction='none',
                      rotation0='0.0',
                      rotation1='0.0',
                      rotation2='0.0'))

        ##self._boundingBox = middleware.request('getBoundingBox', [])
        self._internalChunks.append(
            ccm.Model(type='proprioception',
                      feature='bounding_box',
                      width=repr(0.0),
                      depth=repr(0.0),
                      height=repr(0.0)))
示例#23
0
class MyEnvironment(ccm.Model):
    page_1 = ccm.Model(isa='page_1', location='in_book', state='unturned')
示例#24
0
文件: SGOMS16.py 项目: rlwest/Misc
class MyEnvironment(ccm.Model):
    bread = ccm.Model(isa='bread', location='on_counter')
    cheese = ccm.Model(isa='cheese', location='on_counter')
    ham = ccm.Model(isa='ham', location='on_counter')
    bread_top = ccm.Model(isa='bread_top', location='on_counter')
示例#25
0
class MentalEnvironment(ccm.Model):  # Mental Environment
    scientific_method = ccm.Model(isa='scientific_method',
                                  location='in_mind',
                                  state='unapplied')
示例#26
0
class MyEnvironment(ccm.Model):  
        hammer=ccm.Model(isa='hammer',location='in_hand',state='still')     
        nail=ccm.Model(isa='nail',location='in_wall',state='protruding')
示例#27
0
class MyEnvironment(ccm.Model):

    chicken = ccm.Model(isa='chicken',
                        location='grill',
                        state='cooked',
                        salience=0.2)
    pita = ccm.Model(isa='pita',
                     location='bins2',
                     status='in_bag',
                     salience=0.2)

    cheese = ccm.Model(isa='cheese', location='in_bins1', salience=0.2)
    feta = ccm.Model(isa='feta', location='in_bins1', salience=0.2)
    cucumber = ccm.Model(isa='cucumber', location='in_bins1', salience=0.2)
    green_pepper = ccm.Model(isa='green_pepper',
                             location='in_bins1',
                             salience=0.2)
    mushroom = ccm.Model(isa='mushroom', location='in_bins1', salience=0.2)
    lettuce = ccm.Model(isa='lettuce', location='in_bins1', salience=0.2)
    tomato = ccm.Model(isa='tomato', location='in_bins1', salience=0.2)

    green_olives = ccm.Model(isa='green_olives',
                             location='in_bins2',
                             salience=0.2)
    black_olives = ccm.Model(isa='black_olives',
                             location='in_bins2',
                             salience=0.2)
    hot_peppers = ccm.Model(isa='hot_peppers',
                            location='in_bins2',
                            salience=0.2)
    onion = ccm.Model(isa='onion', location='in_bins2', salience=0.2)

    humus = ccm.Model(isa='humus', location='in_bins2', salience=0.2)
    tzatziki = ccm.Model(isa='tzatziki', location='in_bins2', salience=0.2)

    hot_sauce = ccm.Model(isa='hot_sauce', location='in_bins2', salience=0.2)

    worker = ccm.Model(isa='worker', location='at_counter', salience=0.2)
    spider = ccm.Model(isa='spider',
                       location='on_counter',
                       feature1='yellow_stripe',
                       salience=0.99)

    motor_finst = ccm.Model(isa='motor_finst', state='re_set')
class MyEnvironment(ccm.Model):
    v1 = ccm.Model(isa='dial')
示例#29
0
class MyEnvironment(ccm.Model):
    something = ccm.Model(isa='something', state='not_done')
class MyEnvironment(ccm.Model):

    warning_light = ccm.Model(isa='warning_light', state='off')