示例#1
0
    def move_check(self, positions, output_text=""):
        standard_setup()
        standard_boggle = StandardBoggle(number_of_boards=1, board_size=4)

        standard_boggle.set_board_value(position=positions[0], value='c')
        standard_boggle.set_board_value(position=positions[1], value='o')
        standard_boggle.set_board_value(position=positions[2], value='w')

        # PlayerIO.set_mockup(True)
        # PlayerIO.write_player_gameboard(0, standard_boggle.get_board_string(board_id=0), "", 4)
        self.assertTrue(standard_boggle._check_move(move='cow',
                                                    board_id=0,
                                                    generous_boggle=False,
                                                    register_used_word=False),
                        msg=output_text)

        standard_boggle.set_board_value(position=positions[2], value='c')
        standard_boggle.set_board_value(position=positions[1], value='o')
        standard_boggle.set_board_value(position=positions[0], value='w')

        self.assertTrue(standard_boggle._check_move(move='cow',
                                                    board_id=0,
                                                    generous_boggle=False,
                                                    register_used_word=False),
                        msg=output_text)
示例#2
0
    def test_reused_word(self):
        standard_setup()

        standard_boggle = StandardBoggle(number_of_boards=2, board_size=4)
        standard_boggle.set_board_value(position=(0, 0), value='c')
        standard_boggle.set_board_value(position=(0, 1), value='o')
        standard_boggle.set_board_value(position=(0, 2), value='w')

        standard_boggle._check_move(move='cow',
                                    board_id=0,
                                    generous_boggle=False)

        self.assertTrue(not standard_boggle._check_move(move='cow',
                                                        board_id=0,
                                                        generous_boggle=False))
示例#3
0
    def test_change_dict(self):
        load_compleat_language()

        standard_boggle = StandardBoggle(number_of_boards=2, board_size=4)
        standard_boggle.set_board_value(position=(1, 0), value='n')
        standard_boggle.set_board_value(position=(1, 1), value='o')
        standard_boggle.set_board_value(position=(1, 2), value='t')

        self.assertTrue(standard_boggle._check_move(move='not',
                                                    board_id=0,
                                                    generous_boggle=False))

        load_uncompleat_language()
        self.assertTrue(not standard_boggle._check_move(move='not',
                                                        board_id=0,
                                                        generous_boggle=False))
示例#4
0
    def test_reused_dice(self):
        standard_setup()

        standard_boggle = StandardBoggle(number_of_boards=2, board_size=4)
        standard_boggle.set_board_value(position=(1, 0), value='i')
        standard_boggle.set_board_value(position=(1, 1), value='n')
        standard_boggle.set_board_value(position=(2, 0), value='t')

        self.assertTrue(not standard_boggle._check_move(move='init',
                                                        board_id=0,
                                                        generous_boggle=False))
示例#5
0
    def test_generous_reused_dice(self):
        standard_setup()

        standard_boggle = StandardBoggle(number_of_boards=2, board_size=4)
        standard_boggle.set_board_value(position=(0, 0), value='a')
        standard_boggle.set_board_value(position=(1, 0), value='l')
        standard_boggle.set_board_value(position=(2, 0), value='k')
        standard_boggle.set_board_value(position=(2, 1), value='y')

        self.assertTrue(standard_boggle._check_move(move='alkyl',
                                                    board_id=0,
                                                    generous_boggle=True))