<s> from globals import * <EOL> import life as lfe <EOL> import judgement <EOL> import rawparse <EOL> import action <EOL> import speech <EOL> import brain <EOL> import jobs <EOL> import logging <EOL> def create_question ( life , life_id , gist , ignore_if_said_in_last = <NUM_LIT:0> , recent_time = <NUM_LIT:0> , ** kwargs ) : <EOL> _target = brain . knows_alife_by_id ( life , life_id ) <EOL> _question = { '<STR_LIT>' : gist , '<STR_LIT:args>' : kwargs } <EOL> if not _target : <EOL> logging . critical ( '<STR_LIT>' % ( '<STR_LIT:U+0020>' . join ( life [ '<STR_LIT:name>' ] ) , '<STR_LIT:U+0020>' . join ( LIFE [ life_id ] [ '<STR_LIT:name>' ] ) ) ) <EOL> return False <EOL> if _target [ '<STR_LIT>' ] < recent_time : <EOL> return False <EOL> if _question in _target [ '<STR_LIT>' ] : <EOL> return False <EOL> _sent = speech . has_sent ( life , life_id , gist ) <EOL> if _sent and ( WORLD_INFO [ '<STR_LIT>' ] - _sent < ignore_if_said_in_last or ignore_if_said_in_last == - <NUM_LIT:1> ) : <EOL> return False <EOL> speech . send ( life , life_id , gist ) <EOL> _target [ '<STR_LIT>' ] . append ( _question ) <EOL> def create_order ( life , life_id , order , message , ** kwargs ) : <EOL> _target = brain . knows_alife_by_id ( life , life_id ) <EOL> _order = { '<STR_LIT>' : True , '<STR_LIT>' : order , '<STR_LIT:message>' : message , '<STR_LIT:args>' : kwargs } <EOL> if not _target : <EOL> logging . critical ( '<STR_LIT>' % ( '<STR_LIT:U+0020>' . join ( life [ '<STR_LIT:name>' ] ) , '<STR_LIT:U+0020>' . join ( LIFE [ life_id ] [ '<STR_LIT:name>' ] ) ) ) <EOL> return False <EOL> if _order in _target [ '<STR_LIT>' ] . values ( ) : <EOL> return False <EOL> _order [ '<STR_LIT>' ] = False <EOL> if _order in _target [ '<STR_LIT>' ] . values ( ) : <EOL> return False <EOL> _order [ '<STR_LIT>' ] = True <EOL> _target [ '<STR_LIT>' ] [ str ( _target [ '<STR_LIT>' ] ) ] = _order <EOL> _target [ '<STR_LIT>' ] += <NUM_LIT:1> <EOL> logging . debug ( '<STR_LIT>' % ( '<STR_LIT:U+0020>' . join ( life [ '<STR_LIT:name>' ] ) , '<STR_LIT:U+0020>' . join ( LIFE [ life_id ] [ '<STR_LIT:name>' ] ) , order ) ) <EOL> def get_questions_for_target ( life , life_id ) : <EOL> _target = brain . knows_alife_by_id ( life , life_id ) <EOL> return _target [ '<STR_LIT>' ] <EOL> def get_orders_for_target ( life , life_id , active_only = True ) : <EOL> _active_orders = [ ] <EOL> for order in brain . knows_alife_by_id ( life , life_id ) [ '<STR_LIT>' ] . values ( ) : <EOL> if active_only and not order [ '<STR_LIT>' ] : <EOL> continue <EOL> _active_orders . append ( order ) <EOL> return _active_orders <EOL> def ask_target_question ( life , life_id ) : <EOL> return get_questions_for_target ( life , life_id ) . pop ( <NUM_LIT:0> ) <EOL> def give_target_order ( life , life_id ) : <EOL> return get_orders_for_target ( life , life_id ) [ <NUM_LIT:0> ] [ '<STR_LIT>' ] <EOL> def take_order ( life , life_id ) : <EOL> _orders = get_orders_for_target ( life , life_id ) <EOL> if not _orders : <EOL> return False <EOL> _order = _orders [ <NUM_LIT:0> ] <EOL> _order [ '<STR_LIT>' ] = False <EOL> if '<STR_LIT>' in _order [ '<STR_LIT:args>' ] : <EOL> jobs . join_job ( _order [ '<STR_LIT:args>' ] [ '<STR_LIT>' ] , life_id ) <EOL> return True <EOL> def reject_order ( life , life_id ) : <EOL> _orders = get_orders_for_target ( life , life_id ) <EOL> if not _orders : <EOL> return False <EOL> _order = _orders [ <NUM_LIT:0> ] <EOL> _order [ '<STR_LIT>' ] = False <EOL> if '<STR_LIT>' in _order [ '<STR_LIT:args>' ] : <EOL> jobs . join_job ( _order [ '<STR_LIT:args>' ] [ '<STR_LIT>' ] , life_id ) <EOL> return True <EOL> def give_target_order_message ( life , life_id ) : <EOL> _orders = get_orders_for_target ( life , life_id ) <EOL> print life [ '<STR_LIT:name>' ] , LIFE [ life_id ] [ '<STR_LIT:name>' ] , '<STR_LIT>' , _orders [ <NUM_LIT:0> ] [ '<STR_LIT:message>' ] <EOL> return _orders [ <NUM_LIT:0> ] [ '<STR_LIT:message>' ] <EOL> def rescore_history ( life ) : <EOL> pass <EOL> def detect_lies ( life ) : <EOL> pass <EOL> def reflect ( life ) : <EOL> while life [ '<STR_LIT>' ] : <EOL> _memory = lfe . get_memory_via_id ( life , life [ '<STR_LIT>' ] . pop ( ) ) <EOL> if not rawparse . raw_section_has_identifier ( life , '<STR_LIT>' , _memory [ '<STR_LIT:text>' ] ) : <EOL> continue <EOL> _return_value = lfe . execute_raw ( life , '<STR_LIT>' , _memory [ '<STR_LIT:text>' ] ) <EOL> if _return_value == '<STR_LIT>' : <EOL> judgement . judge_chunk ( life , _memory [ '<STR_LIT>' ] , investigate = True ) <EOL> def process ( life ) : <EOL> detect_lies ( life ) <EOL> rescore_history ( life ) <EOL> reflect ( life ) </s>
