예제 #1
0
 def test_score_reg_sol(self):
     rack = "ABCDEFG"
     sol = solve(rack, wordfile)
     scr = score(sol)
     assert len(scr) == 10
     assert len(scr[11]) == 2
     assert "DECAF" in scr[11]
     assert "FACED" in scr[11]
예제 #2
0
def add_word_down(board, word, x, y):
    length = len(word)
    score = scrabble.score(word)

    for i in range(length):
        elm = board[x + i][y]
        if elm == 'T':
            score *= 3
        if elm == 'D':
            score *= 2
        if elm == 't':
            score += scrabble.score(word[i]) * 2
        if elm == 'd':
            score += scrabble.score(word[i])
        board[x + i][y] = word[i]

    return score
예제 #3
0
 def test_whitespace_scores_zero(self):
     self.assertEqual(0, score(" \t\n"))
예제 #4
0
 def test_empty_word_scores_zero(self):
     self.assertEqual(0, score(""))
예제 #5
0
 def test_scores_are_case_insensitive(self):
     self.assertEqual(41, score("oxyphenbutazone"))
예제 #6
0
 def test_complicated_word_scores_more(self):
     self.assertEqual(22, score("quirky"))
예제 #7
0
 def test_simple_word_scores_the_number_of_letters(self):
     self.assertEqual(6, score("street"))
예제 #8
0
 def test_scores_other_very_short_word(self):
     self.assertEqual(4, score('f'))
예제 #9
0
 def test_scores_very_short_word(self):
     self.assertEqual(1, score('a'))
예제 #10
0
 def test_invalid_word_scores_zero(self):
     self.assertEqual(0, score(''))
     self.assertEqual(0, score(' \t\n'))
     self.assertEqual(0, score('hous3'))
     self.assertEqual(0, score('wo rd'))
예제 #11
0
 def test_invalid_word_scores_zero(self):
     self.assertEqual(0, score(''))
     self.assertEqual(0, score(' \t\n'))
     self.assertEqual(0, score('hous3'))
     self.assertEqual(0, score('wo rd'))
예제 #12
0
 def test_scores_are_case_insensitive(self):
     self.assertEqual(20, score("MULTIBILLIONAIRE"))
예제 #13
0
 def test_scores_are_case_insensitive(self):
     self.assertEqual(20, score("MULTIBILLIONAIRE"))
예제 #14
0
 def test_score_one_sol(self):
     rack = "AA"
     sol = solve(rack, wordfile)
     scr = score(sol)
     assert len(scr) == 1
     assert 'AA' in scr[2][0]