当前位置: 首页>>代码示例>>Python>>正文


Python Agent.present_number方法代码示例

本文整理汇总了Python中agent.Agent.present_number方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.present_number方法的具体用法?Python Agent.present_number怎么用?Python Agent.present_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在agent.Agent的用法示例。


在下文中一共展示了Agent.present_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import present_number [as 别名]

#.........这里部分代码省略.........
    def save_start_time(self):
        self.start_time = datetime.datetime.now()
        self.agent.emo_module.wasabi.log_wasabi=True
        

    def start(self):
        ''' Show init text and wait for start button.
        '''
        print 'started!'
        return self.agent.start()

    
    def present_word(self, now):
        '''
        '''
        time_delta = now-self.start_time
        print time_delta, ': PRESENT WORD', time_delta.seconds
        
        if self.has_next():
            word = self.pairs[self.index].word
            number = self.pairs[self.index].number
            
            self.logger.log('\nTask [{0} : {1}] @ {2}s'.format(
                            word.word, number.word, time_delta))
            
            self.pairs[self.index].word_called(utilities.milliseconds(now))
            self.start_time_answer = now
            self.answer_given = False

            return self.agent.present_word(word, number)
        else:
            print 'Index Error'

    def present_number(self, now):
        '''
        '''
        time_delta = now-self.start_time
        print time_delta, ': PRESENT NR', time_delta.seconds
        # Check if answer has been given. If not evaluate.
        if not self.answer_given:
            self.logger.log('  No answer given')
            self.evaluate('-1', now)        
        
        if 0 <= self.index and self.index <= len(self.pairs):
            number = self.pairs[self.index].number
            self.pairs[self.index].number_called(utilities.milliseconds(now))
            self.index += 1

            return self.agent.present_number(number)
        else:
            print 'Index Error'


    def evaluate(self, received, now):
        ''' 
        '''
        time_delta = now-self.start_time
        print time_delta, 'EVALUATE', now-self.start_time_answer
        self.answer_given = True
        
        correct = 0
        if received == self.pairs[self.index].number.word:
            correct = 1
        elif received == '-1':
            correct = 2
                
开发者ID:philipstahl,项目名称:emotutor,代码行数:69,代码来源:environment.py


注:本文中的agent.Agent.present_number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。