Esempio n. 1
0
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)
Esempio n. 2
0
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()
Esempio n. 3
0
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="")
Esempio n. 4
0
File: test.py Progetto: unshift/ita
 def test_duplicates_other(self):
     """"Another negative example with duplicates"""
     words = scrabble(['xyzz'], ['x', 'y', 'z'])
     self.assertTrue(len(words) == 0)
Esempio n. 5
0
File: test.py Progetto: unshift/ita
 def test_duplicates_negative(self):
     """Negative example with duplicate letters"""
     words = scrabble(['aaa', 'bbb'], ['a', 'a', 'b', 'b'])
     self.assertTrue(len(words) == 0)
Esempio n. 6
0
File: test.py Progetto: unshift/ita
 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)
Esempio n. 7
0
File: test.py Progetto: unshift/ita
 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)
Esempio n. 8
0
File: test.py Progetto: unshift/ita
 def test_simple(self):
     """Simple example"""
     words = scrabble(["xyz"], ['x', 'y', 'z'])
     self.assertTrue(words == ["xyz"])
Esempio n. 9
0
 def test_duplicates_other(self):
     """"Another negative example with duplicates"""
     words = scrabble(['xyzz'], ['x', 'y', 'z'])
     self.assertTrue(len(words) == 0)
Esempio n. 10
0
 def test_duplicates_negative(self):
     """Negative example with duplicate letters"""
     words = scrabble(['aaa', 'bbb'], ['a', 'a', 'b', 'b'])
     self.assertTrue(len(words) == 0)
Esempio n. 11
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)
Esempio n. 12
0
 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)
Esempio n. 13
0
 def test_simple(self):
     """Simple example"""
     words = scrabble(["xyz"], ['x', 'y', 'z'])
     self.assertTrue(words == ["xyz"])