コード例 #1
0
ファイル: autogalgje.py プロジェクト: zarq/galgje
def raadfn(letter, template):
    geraden, goede_letter, template = galgje_guess(state, letter)
    return goede_letter, template
コード例 #2
0
ファイル: seed_cache2.py プロジェクト: zarq/galgje
    return top_letter


failed_words = set()
start = time.time()
done_count = 0
for word in all_words:
    state, template = galgje_master(word)

    letters_die_er_niet_in_zitten = set()
    while True:
        try:
            letter = galgje_reentrant(template, letters_die_er_niet_in_zitten)
            if letter == None:
                break
            geraden, goede_letter, template = galgje_guess(state, letter)
            if not goede_letter:
                letters_die_er_niet_in_zitten.add(letter)
            if geraden:
                break
        except GalgjeError:
            failed_words.add(word)
            with open("nietgeraden", "a") as f:
                f.write(word + '\n')
            break

    debug("guesses: %.1f/s, hits=%.1f%%" % (guesses[0]/(time.time() - start),
                                            float(100.0 * cache_hits[0]) / (cache_hits[0] + cache_misses[0])))
    done_count += 1
    done = float(done_count) / len(all_words)
    debug("%.3f%% of %d words" % (done * 100.0, len(all_words)))