Example #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)
Example #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()
Example #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="")
Example #4
0
File: test.py Project: unshift/ita
 def test_duplicates_other(self):
     """"Another negative example with duplicates"""
     words = scrabble(['xyzz'], ['x', 'y', 'z'])
     self.assertTrue(len(words) == 0)
Example #5
0
File: test.py Project: 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)
Example #6
0
File: test.py Project: 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)
Example #7
0
File: test.py Project: 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)
Example #8
0
File: test.py Project: unshift/ita
 def test_simple(self):
     """Simple example"""
     words = scrabble(["xyz"], ['x', 'y', 'z'])
     self.assertTrue(words == ["xyz"])
Example #9
0
 def test_duplicates_other(self):
     """"Another negative example with duplicates"""
     words = scrabble(['xyzz'], ['x', 'y', 'z'])
     self.assertTrue(len(words) == 0)
Example #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)
Example #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)
Example #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)
Example #13
0
 def test_simple(self):
     """Simple example"""
     words = scrabble(["xyz"], ['x', 'y', 'z'])
     self.assertTrue(words == ["xyz"])