def run(): """ Run game. """ #list1 = ["aye", "bye", "bye", "hi", "hi", "oh"] #list1 = ["aye"] #list2 = ["cya", "bye", "aye"] #sortedlist = merge_sort(list2) #print "merge_sorted", sortedlist #list3 = ["bye", "oh", "hi", "hi"] #list2 = remove_duplicates(list1) #inter = intersect(list1, list3) #merged = merge(list1, list2) #print "merged", merged #print "remove_dupes", list2 #all_strings = gen_all_strings("bar") #print "all strings", all_strings words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler)
def run(): """ Run game. """ words = load_words("assets_scrabble_words3.txt") wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler)
def run(): """ Run game. """ words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler)
def run(): """ Run game. """ words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler) # Uncomment when you are ready to try the game #run() #import user36_Yqz4xpLLQ9GHulY as testsuite # #testsuite.run_test1(remove_duplicates) #testsuite.run_test2(intersect) #testsuite.run_test3(merge) #testsuite.run_test4(merge_sort) #testsuite.run_all(remove_duplicates, intersect, merge, merge_sort) #import user36_UCQdx0ysZUFYetB as testsuite # #testsuite.run_test1(remove_duplicates) ##testsuite.run_test2(intersect) ##testsuite.run_test3(merge) ##testsuite.run_test4(merge_sort) #testsuite.run_test5(gen_all_strings) #testsuite.run_all(remove_duplicates, intersect, merge, merge_sort, gen_all_strings)
def run(): """ Run game. """ words = load_words('assets_scrabble_words3.txt') wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler)
def run(): ''' Run game. ''' words = load_words(WORDFILE) wrangler = wrangler.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) wrangler.run_game(wrangler)
def run(): """ Run game. """ words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler) # Uncomment when you are ready to try the game # run()
def run(): """ Run game. """ words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler) # Uncomment when you are ready to try the game ## run() #print range(-1) ###print merge([1,2,2,4,4,5,6,7],[2,3,3,5,8,9]) ##print merge([3, 4, 5], [3, 4, 5]) ##a = range(5) ##print a[:4] #print merge([2],[2]) #print merge_sort([20, 9,8,9, 10,4,5,4, 2]) #print gen_all_strings("") #print gen_all_strings("b") #print gen_all_strings("ab") #print gen_all_strings("abc") # #print len(['', 'd', 'd', 'dd', 'dd', 'g', 'gd', 'dg', 'gd', 'dg', 'gdd', 'dgd', 'ddg', 'gdd', 'dgd', 'ddg', 'g', 'gd', 'dg', 'gd', 'dg', 'gdd', 'dgd', 'ddg', 'gdd', 'dgd', 'ddg', 'gg', 'gg', 'ggd', 'ggd', 'gdg', 'gdg', 'dgg', 'dgg', 'ggd', 'ggd', 'gdg', 'gdg', 'dgg', 'dgg', 'ggdd', 'ggdd', 'gdgd', 'gddg', 'gdgd', 'dggd', 'dggd', 'dgdg', 'gddg', 'dgdg', 'ddgg', 'ddgg', 'ggdd', 'ggdd', 'gdgd', 'gddg', 'gdgd', 'dggd', 'dggd', 'dgdg', 'gddg', 'dgdg', 'ddgg', 'ddgg']) #print len(['ggd', 'ggd', 'gdg', 'gdg', 'dgg', 'dgg', 'ggdd', 'ggd', 'dgd', 'gddg', 'gdgd', 'dgg', 'ggd', 'dgdg', 'gddg', 'dgd', 'dgg', 'ddgg', 'ggdd', 'ggd', 'dgd', 'gddg', 'gdgd', 'dgg', 'ggd', 'dgdg', 'gddg', 'dgd', 'dgg', 'ddgg', 'gg', 'gg', 'ggd', 'ggd', 'gdg', 'gdg', 'dgg', 'dgg', 'gd', 'dg', 'gdd', 'dgd', 'ddg', 'gdd', 'dgd', 'ddg', 'g', 'gd', 'dg', 'gd', 'dg', 'gdd', 'dgd', 'ddg', 'gdd', 'dgd', 'ddg', 'g', 'gd', 'dg', 'd', 'dd', 'dd', '', 'd']) #string = "abc" #first = "0" #tmp =[] #for idx in range(len(string)): # tmp.append(string[:idx]+first+string[idx:]) # #print tmp # #
def run(): """ Run game. """ words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler) # Uncomment when you are ready to try the game #run() #listeryo = ('hello', 'hi', 'hi', 'yo') #listerhi = ('hello', 'hi', 'hullo', 'yello', 'yellow') #merge(listeryo, listerhi) #list3 = ('yo', 'hello', 'hi', 'yello', 'hullo') #print merge_sort(list3) #print gen_all_strings("abb")
def run(): """ Run game. """ words = load_words(WORDFILE) wrangler = provided.WordWrangler(words, remove_duplicates, intersect, merge_sort, gen_all_strings) provided.run_game(wrangler) # Uncomment when you are ready to try the game # run() # Testing # def run_suite(option): # """ # Some informal testing code # """ # # create a TestSuite object # suite = poc_simpletest.TestSuite() # def test_remove_duplicates(): # print "--------------------" # print "\nTesting remove_duplicates:" # list1 = ["apple", "bacon", "taser", "bacon", "apple", "broom", "bacon"] # list2 = remove_duplicates(list1) # suite.run_test(list2, ['apple', 'bacon', 'taser', 'broom'], "Test #1:") # list1 = ["brains", "screams", "boom", "brains", "brains", "screams"] # list2 = remove_duplicates(list1) # suite.run_test(list2, ['brains', 'screams', 'boom'], "Test #2:") # def test_intersect(): # print "--------------------" # print "\nTesting intersect:" # list1 = ["Trump", "Vietnam", "The Black Keys", "tube amp"] # list2 = ["tube amp", "The Black Keys", "rain", "May"] # inter = intersect(list1, list2) # suite.run_test(inter, ['The Black Keys', 'tube amp'], "Test #3:") # list1 = ["red", "blue", "green"] # list2 = ["white", "orange", "green"] # inter = intersect(list1, list2) # suite.run_test(inter, ['green'], "Test #4:") # def test_merge(): # print "--------------------" # print "\nTesting merge:" # list1 = ["apple"] # list2 = ["zebra"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['apple', 'zebra'], "Test #5:") # list1 = ["boat"] # list2 = ["accident"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['accident', 'boat'], "Test #6:") # list1 = ["apple", "boat"] # list2 = ["zebra"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['apple', 'boat','zebra'], "Test #7:") # list1 = ["apple", "cloud"] # list2 = ["boat"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['apple', 'boat', 'cloud'], "Test #8:") # list1 = ["shore", "tugboat"] # list2 = ["anchor"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['anchor', 'shore', 'tugboat'], "Test #9:") # list1 = ["apple"] # list2 = ["boat", "fog"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['apple', 'boat', 'fog'], "Test #10:") # list1 = ["cloud"] # list2 = ["boat", "fog"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['boat', 'cloud', 'fog'], "Test #11:") # list1 = ["sail"] # list2 = ["boat", "fog"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['boat', 'fog', 'sail'], "Test #12:") # list1 = ["dark", "fog"] # list2 = ["cloud", "crow"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['cloud', 'crow', 'dark', 'fog'], "Test #13:") # list1 = ["apple", "dredge"] # list2 = ["boat", "cloud"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['apple', 'boat', 'cloud', 'dredge'], "Test #14:") # list1 = ["apple", "boat"] # list2 = ["dredge", "shoreline"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['apple', 'boat', 'dredge', 'shoreline'], "Test #15:") # list1 = ["alight", "dredge"] # list2 = ["cloud", "shoreline"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['alight', 'cloud', 'dredge', 'shoreline'], "Test #16:") # list1 = ["anchor", "dredge"] # list2 = ["alight", "cloud"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['alight', 'anchor', 'cloud', 'dredge'], "Test #17:") # list1 = ["anchor", "dredge"] # list2 = ["bridge", "lighthouse"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['anchor', 'bridge', 'dredge', 'lighthouse'], "Test #18:") # list1 = ["capsized", "riptide"] # list2 = ["alight", "thunderstorm"] # merged_list = merge(list1, list2) # suite.run_test(merged_list, ['alight', 'capsized', 'riptide', 'thunderstorm'], "Test #19:") # def test_gen_all_strings(): # global REST_STRINGS # print "--------------------" # print "\nTesting gen_all_strings:" # REST_STRINGS = [] # word = "a" # unfiltered_result = gen_all_strings(word) # suite.run_test(gen_all_strings(word), ['', 'a'], "Test #20:") # REST_STRINGS = [] # word = "ok" # unfiltered_result = gen_all_strings(word) # suite.run_test(gen_all_strings(word), ['', 'o', 'ok', 'k', 'ko'], "Test #21:") # REST_STRINGS = [] # word = "bin" # unfiltered_result = gen_all_strings(word) # suite.run_test(gen_all_strings(word), ['', 'b', 'bi', 'bin', 'bn', 'bni', 'i', 'ib', 'ibn', 'in', 'inb', 'n', 'nb', 'nbi', 'ni', 'nib'], "Test #22:") # REST_STRINGS = [] # word = "aa" # unfiltered_result = gen_all_strings(word) # suite.run_test(gen_all_strings(word), ['', 'a', 'aa', 'aa'], "Test #23:") # def test_all(): # print "-------------------" # print "\nRunning all tests:" # test_remove_duplicates() # test_intersect() # test_merge() # test_gen_all_strings() # test_choices = {1: test_all, # 2: test_remove_duplicates, # 3: test_intersect, # 4: test_merge, # 5: test_gen_all_strings} # try: # test_choices[option]() # except KeyError, e: # print "KeyError %s" % str(e) # suite.report_results() # Testing options: # 1: test_all # 2: test_remove_duplicates # 3: test_intersect # 4: test_merge # 5: test_gen_all_strings # run_suite(1)