21 lines
432 B
Python
21 lines
432 B
Python
from a_player import APlayer
|
|
from numpy.random import uniform
|
|
|
|
|
|
class PlayerProvider:
|
|
def __init__(self, p1: APlayer, p2: APlayer):
|
|
self.players = [p1, p2]
|
|
|
|
def choose(self) -> list[APlayer]:
|
|
# Wer fängt an?
|
|
players = self.players
|
|
if uniform() < 0.5:
|
|
players.reverse()
|
|
|
|
result = players
|
|
players[0].new_game()
|
|
players[1].new_game()
|
|
|
|
return result
|
|
|