示例#1
0
    def choose_clubs(self, *args):
        self.player1.choice = Choice.CLUBS
        choose_strategy(self.player2)
        choose_strategy(self.player3)
        choose_strategy(self.player4)
        choose_strategy(self.player5)

        for child in self.children:
            if child.name == 'players':
                for child1 in child.children:
                    if child1.name == 'player2':
                        child1.add_widget(
                            Label(name='strategy',
                                  text='Estrategia: ' +
                                  str(self.player2.choice),
                                  pos_hint={
                                      'center_x': 0.5,
                                      'center_y': 0.05
                                  }))
                    if child1.name == 'player3':
                        child1.add_widget(
                            Label(name='strategy',
                                  text='Estrategia: ' +
                                  str(self.player3.choice),
                                  pos_hint={
                                      'center_x': 0.5,
                                      'center_y': 0.05
                                  }))
                    if child1.name == 'player4':
                        child1.add_widget(
                            Label(name='strategy',
                                  text='Estrategia: ' +
                                  str(self.player4.choice),
                                  pos_hint={
                                      'center_x': 0.5,
                                      'center_y': 0.05
                                  }))
                    if child1.name == 'player5':
                        child1.add_widget(
                            Label(name='strategy',
                                  text='Estrategia: ' +
                                  str(self.player5.choice),
                                  pos_hint={
                                      'center_x': 0.5,
                                      'center_y': 0.05
                                  }))

            if child.name == 'player1':
                for child1 in child.children:
                    if child1.name == 'buttons':
                        child1.clear_widgets()
                        child1.add_widget(
                            Label(name='strategy',
                                  text='Estrategia: Tréboles'))
                    if child1.name == 'cards':
                        for child2 in child1.children:
                            child2.disabled = False
示例#2
0
from functions_for_algorythm import MiniMax, choose_strategy, get_points
from player import Player
import time

deck = Deck()
deck.deck_shuffle()

player1 = Player("player 1", hand=deck.draw(10), turn=True)
player2 = Player("player 2", hand=deck.draw(10))
player3 = Player("player 3", hand=deck.draw(10))
player4 = Player("player 4", hand=deck.draw(10))
player5 = Player("player 5", hand=deck.draw(10))

minimax = MiniMax(deck, [player1, player2, player3, player4, player5])

choose_strategy(player1)
choose_strategy(player2)
choose_strategy(player3)
choose_strategy(player4)
choose_strategy(player5)

player1.hand.sort()
player2.hand.sort()
player3.hand.sort()
player4.hand.sort()
player5.hand.sort()

for player in minimax.players:
    for position in range(0, len(player.hand)):
        player.hand[position].position_hand = position