def scrabble_cheat(message, channel): rack = message.split()[1] words = scrabble(rack) result = "Bingo!! Here's the cheat ... \ \n Use the word with max. score and WIN your Scrabble game in minutes\n\n" for word in words: result += 'score: ' + str(word[0]) + ' ' + word[1] + '\n' post_message(result, channel)
def switch_number(arg): # dictionary switcher = { 0: lambda: print("Bye!!"), 1: scrabble(), # 2: init2, 3: all, } func = switcher.get(arg, error('unknown func!')) print("(!) func (exec0.) ==> " + func.__name__) return func()
def addNums(): val = request.form["string"] #print val #flask.flash(val) res = scrabble.scrabble('test.txt', 8) for i in res: flask.flash(i) return render_template("index.html", string="", result="")
def test_duplicates_other(self): """"Another negative example with duplicates""" words = scrabble(['xyzz'], ['x', 'y', 'z']) self.assertTrue(len(words) == 0)
def test_duplicates_negative(self): """Negative example with duplicate letters""" words = scrabble(['aaa', 'bbb'], ['a', 'a', 'b', 'b']) self.assertTrue(len(words) == 0)
def test_duplicates_simple(self): """Example with duplicate letters""" words = scrabble(['aa', 'bb'], ['a', 'a', 'b', 'b']) self.assertTrue(len(words) == 2) self.assertTrue('aa' in words) self.assertTrue('bb' in words)
def test_example(self): """Example that was given on the sheet""" words = scrabble(self.EXAMPLE_WORDLIST, self.EXAMPLE_LETTERS) self.assertTrue(len(words) == len(self.EXAMPLE_WORDLIST)) for word in words: self.assertTrue(word in self.EXAMPLE_WORDLIST)
def test_simple(self): """Simple example""" words = scrabble(["xyz"], ['x', 'y', 'z']) self.assertTrue(words == ["xyz"])