Пример #1
0
 def test_game_check_winner(self):
     game = Game()
     assert game.check_winner() is False
     assert len(game.winners) == 0
     user = User()
     game.winners.append(user)
     user.is_winner = True
     assert game.check_winner() is True
Пример #2
0
 def test_game_init(self):
     game = Game()
     assert game.num_users == 0
     assert game.num_compics == 0
     assert game.players == {}
     assert isinstance(game.bag, Bag)
     assert len(game.bag.nums) == 90
     assert game.winners == game.losers
Пример #3
0
 def test_game_generate_players(self):
     game = Game()
     game.generate_players(1, 1)
     assert len(game.players) == 2
     assert 'compic-1' in game.players.keys()
     assert 'user-1' in game.players.keys()
     assert 'compic-2' not in game.players.keys()
     assert 'user-2' not in game.players.keys()
     assert isinstance(game.players['compic-1'], Computer)
     assert isinstance(game.players['user-1'], User)
     game.generate_players(2, 2)
     assert len(game.players) == 4
Пример #4
0
from loto_classes import Game, Bag

if __name__ == '__main__':

    num_compics = int(input('Введите число компьютерных игроков: '))
    num_users = int(input('Введите число живых игроков: '))

    game = Game()
    game.run(num_compics, num_users)