当前位置: 首页>>代码示例>>Python>>正文


Python Solution.determine_score方法代码示例

本文整理汇总了Python中solution.Solution.determine_score方法的典型用法代码示例。如果您正苦于以下问题:Python Solution.determine_score方法的具体用法?Python Solution.determine_score怎么用?Python Solution.determine_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solution.Solution的用法示例。


在下文中一共展示了Solution.determine_score方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_double_letter_triple_word

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
    def test_double_letter_triple_word(self):

        # Double letter and triple word.
        board = Board()
        solution = Solution(0, 0, HORIZONTAL, "HELLO")
        solution.determine_score(board, self.dic)
        self.assertEqual(solution.score, 27)
开发者ID:flibustenet,项目名称:scrabble,代码行数:9,代码来源:test_score.py

示例2: test_extending_perpendicular_word

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
 def test_extending_perpendicular_word(self):
     # Extending perpendicular word.
     board = Board()
     board.add_word("MILO", Board.MID_ROW, Board.MID_COL - 1, HORIZONTAL)
     solution = Solution(Board.MID_ROW - 3, Board.MID_COL + 3, VERTICAL, "DOGS")
     solution.determine_score(board, self.dic)
     # DOGS = 6*2, MILOS = 7
     self.assertEqual(solution.score, 19)
开发者ID:flibustenet,项目名称:scrabble,代码行数:10,代码来源:test_score.py

示例3: test_intersecting_word

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
 def test_intersecting_word(self):
     # Intersecting word.
     board = Board()
     board.add_word("MILO", Board.MID_ROW, Board.MID_COL - 1, HORIZONTAL)
     solution = Solution(Board.MID_ROW - 1, Board.MID_COL + 2, VERTICAL, "DOG")
     solution.determine_score(board, self.dic)
     # DOG = 5
     self.assertEqual(solution.score, 5)
开发者ID:flibustenet,项目名称:scrabble,代码行数:10,代码来源:test_score.py

示例4: test_double_letter_triple_word_twice

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
 def test_double_letter_triple_word_twice(self):
     # Double letter and triple word twice.
     board = Board()
     solution = Solution(14, 0, HORIZONTAL, "COMPUTER")
     solution.determine_score(board, self.dic)
     # C3 + O1 + M3 + 2*P=6 + U1 + T1 + E1 + R1 = 17
     # 17 * 3 * 3 = 153
     self.assertEqual(solution.score, 153)
开发者ID:flibustenet,项目名称:scrabble,代码行数:10,代码来源:test_score.py

示例5: test_pluralizing

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
 def test_pluralizing(self):
     # Pluralizing.
     board = Board()
     solution = Solution(Board.MID_ROW, Board.MID_COL - 1, HORIZONTAL, "DOG")
     solution.determine_score(board, self.dic)
     self.assertEqual(solution.score, 10)
     board.add_solution(solution)
     solution = Solution(Board.MID_ROW, Board.MID_COL - 1, HORIZONTAL, "DOGS")
     solution.determine_score(board, self.dic)
     self.assertEqual(solution.score, 6)
开发者ID:flibustenet,项目名称:scrabble,代码行数:12,代码来源:test_score.py

示例6: test_cross_with_blank

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
    def test_cross_with_blank(self):
        dic = Dictionary()
        dic.set_words(["SA","JETS"])

        board = Board()
        board.add_word('JET', 5, 4, VERTICAL)
        sol= Solution(8, 4, HORIZONTAL, 'SA', []) 
        sol.determine_score(board, dic)
        self.assertEqual(sol.score, 13)
        sol= Solution(8, 4, HORIZONTAL, 'SA', [0]) 
        sol.determine_score(board, dic)
        self.assertEqual(sol.score, 11)
        board.add_solution(sol)
开发者ID:flibustenet,项目名称:scrabble,代码行数:15,代码来源:test_score.py

示例7: test_two_letter_one_blank

# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import determine_score [as 别名]
    def test_two_letter_one_blank(self):
        dic = Dictionary()
        dic.set_words(["DUCE","EGRUGEAI"])

        board = Board()
        board.add_word('DUCE', 7, 4, HORIZONTAL)
        sol= Solution(7, 7, VERTICAL, 'EGRUGEAI', [1]) 
        sol.determine_score(board, dic)
        sol= Solution(7, 7, VERTICAL, 'EGRUGEAI', [4]) 
        sol.determine_score(board, dic)

        solutions = board.generate_solutions('RUIAG?E', dic)
        solution = board.find_best_solution(solutions, dic)
        self.assertEqual(solution.score, 80)
开发者ID:flibustenet,项目名称:scrabble,代码行数:16,代码来源:test_score.py


注:本文中的solution.Solution.determine_score方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。