def __init__(self, client, address, db):
     super().__init__()
     self.client = client
     self.address = address
     self.db = db
     self.config = json.loads(open('config.json', 'r').read())
     self.device = Device(self.client)
     self.player = Player(self.device)
Esempio n. 2
0
    def __init__(self, mode='Play', replay_moves=None, patch=PATCH):
        """ Set up players, variables, and start the game! """
        # Make objects
        player1_name = '1'
        player2_name = '2'
        self.player1 = Player(
            0, player1_name
        )  # Make first player, parameter is the name of the player
        self.player2 = Player(1, player2_name)  # Make second player
        self.field = Field()  # Make field

        # Place for variables
        self.mode = mode
        self.patch = patch
        if self.patch != PATCH:
            self.patch_info = dict()
            self.fill_patch_info()
        else:
            self.patch_info = CARDS
        self.active_player = self.player1
        if mode == 'Play':
            self.moves = list(
            )  # Make list to store all played moves for replay
        self.actions = dict()  # Make dictionary for all available commands
        self.actions_replay = dict()
        self.playing = True
        self.open = True
        self.note = None  # Variable for message sent to user
        if replay_moves is not None:
            self.replay_moves = replay_moves
            self.line = 1

        # Initialization functions
        self.set_available_inputs()  # Set all commands
        self.set_field_player()  # Connect field to the correct player

        # Game loop
        self.loop()  # Start the game
Esempio n. 3
0
 def __init__(self, data, device):
     super().__init__(data)
     self.device = device
     self.player = Player(device)
Esempio n. 4
0
 def __init__(self, client, address):
     super().__init__()
     self.client = client
     self.address = address
     self.device = Device(self.client)
     self.player = Player(self.device)
 def __init__(self, client, addr):
     super().__init__()
     self.client = client
     self.addr = addr
     self.crypto = NaCl()
     self.player = Player()