Beispiel #1
0
    def test_is_game_over(self):

        # test all tiles taken
        owner = cycle([self.game.player1, self.game.player2])
        for tile in self.game.tiles:
            tile.status = WordsmushTile.TAKEN
            tile.owner = next(owner)

        self.assertTrue(self.game.is_game_over())

        # test only some tiles taken
        tile1 = self.game.get_tile(2,2)
        tile2 = self.game.get_tile(3,3)
        tile1.owner = None
        tile1.status = WordsmushTile.UNTAKEN
        tile2.owner = None
        tile2.status = WordsmushTile.UNTAKEN

        self.assertFalse(self.game.is_game_over())

        # test no tiles taken
        self.game = game_utils.get_alpha_board()
        self.assertFalse(self.game.is_game_over())
Beispiel #2
0
 def setUp(self):
     self.game = game_utils.get_alpha_board()