예제 #1
0
def _generate_more_random_things(count, results, things):
    """Add count more random things to existing results. It's "random" as
    implemented in oracle.py, not 'random' module."""
    initial_length = len(results)
    while len(results) <= initial_length + count:
        results.append(oracle.select_new_thing(things, results, LARGE_WINDOW))
    return (results, results[-count:])
예제 #2
0
파일: __init__.py 프로젝트: yacoob/whatnow
def propose_selection():
    """Pick a thing at random, ask user for acceptance."""
    things, results = _init_data()
    new_thing = oracle.select_new_thing(things, results, WINDOW_SIZE)
    print 'I have selected something for you:\n  %s' % new_thing
    try:
        answer = raw_input('Do you like it (Y/n) ').lower()
    except EOFError:
        answer = 'n'
    if answer in ('y', ''):
        results.append(new_thing)
        results.writeback()
        print "Glad to hear it. I've recorded your choice."
    else:
        print 'Okay. Not recording anything.'