def play_game(self): # A game has started self.chips.ask_chips() while True: # Initiate a new round and play the round new_round = Round(self) new_round.play_round() # Ask to play again self.playing = input( "Do you want to play again? Yes (press any key) or No (press Enter)? " ) balance = self.chips.check_balance() if self.playing and balance: # Wants to play again and has a balance self.game_round += 1 continue else: # Wants to exit print("Thanks for playing!") break
def playNextRound(self): currentRound = Round(self.players, self.DISPLAYSURF, self.bigBlind, self.smlBlind) while (currentRound.isComplete == False): self.checkForQuit() currentRound.makeNextMove() self.CLOCK.tick(10)
def matchPlayers(playersList, tournament): round = Round(playersList) tournament.addRound(round) roundNo = tournament.getRoundNo() print("Match Players (Round " + str(roundNo) + ")") print() round.matchPlayers(tournament)
def play(self): print("Welcome to Dunno - a fast-paced card game for 2-6 players.") self.getPlayers() self.getNumRounds() for r in range(self.num_rounds): dunno_round = Round(self.players, self.cards_per_player, self.jokers) dunno_round.play() self.printFinalScores()
def playGame(self): # Checks that both teams have not reached 11 before moving to the next round while not self.team1.hasWon() and not self.team2.hasWon(): currentRound = Round(self.players) currentRound.playRound() self.allotScore(currentRound) game.dealer = self.rotateDeal() return self.getWinner()
def play(self): while max(self.scores) < self.max_score: self.curr_round = Round(self.server, self.pass_dirs[self.pass_dir_num]) self.curr_round.play() for i in range(self.num_players): self.scores[i] += self.curr_round.scores[i] self.server.broadcast(self.get_scores_str()) self.round_num += 1 self.pass_dir_num = (self.pass_dir_num + 1) % len(self.pass_dirs)
def play_round(self): print "You have " + str(self.contestant.bank) + " dollars in the bank." bid = int(raw_input("How many dollars would you like to bet?").strip()) if bid > self.contestant.bank: print "You can't bet more than you have!" self.play_round() r = Round(self.contestant, self.dealer, bid) r.play()
def test_dealer_busts(): game = Game() round = Round(game) chips = game.chips chips.total = 100 chips.bet = 10 # Setup dealer to bust round.dealer.value = 22 round.get_the_winner() # chips.win_bet assert chips.total == 110
def test_player_busts(): game = Game() round = Round(game) chips = game.chips chips.total = 100 chips.bet = 10 # Setup player to bust round.player.value = 22 round.get_the_winner() # chips.lose_bet assert chips.total == 90
def test_tie(): game = Game() round = Round(game) chips = game.chips chips.total = 100 chips.bet = 10 # Setup tie round.player.value = 20 round.dealer.value = 20 round.get_the_winner() assert chips.total == 100
def test_player_wins(): game = Game() round = Round(game) chips = game.chips chips.total = 100 chips.bet = 10 # Setup player to win round.player.value = 20 round.dealer.value = 19 round.get_the_winner() # chips.win_bet assert chips.total == 110
def startGame(self): currentRound = None Player.players = [] for i in range(TractorGame.NUM_PLAYERS): Player.players.append(Player(i)) while True: if currentRound == None: currentRound = Round(Player.players[0]) else: currentRound = Round(Player.players[currentRound.getWinner()]) currentRound.start()
def play(self): while max(self.scores) < self.max_score: pass_dir = self.pass_dirs[self.pass_dir_num] self.curr_round = Round(self, pass_dir) self.curr_round.play() for i in range(self.num_players): self.scores[i] += self.curr_round.scores[i] self.logger.log_round(round_num=self.round_num, pass_dir=pass_dir, player=self.server.usernames[i], round_score=self.curr_round.scores[i], cum_score=self.scores[i]) self.server.broadcast(self.get_scores_str()) self.round_num += 1 self.pass_dir_num = (self.pass_dir_num + 1) % len(self.pass_dirs)
def __init__(self, team_names=["e1","e2"], player_names=["j1","j2","j3","j4"], player_bots=[False,True,True,True], score_limit=2000,hidden=False, difficulty="beginner"): GraphicManager.hidden=hidden self.data= {"team_names":team_names, "player_names":player_names, "player_bots":player_bots} self.round=Round(team_names=self.data["team_names"], player_names=self.data["player_names"], player_bots=self.data["player_bots"], number=0,pioche=Hand(name="pioche",cards=[Card(i,j) for i in const.NUMBERS for j in const.COLORS[:4]]), difficulty=difficulty) self.limit=score_limit self.score={team_names[0]:0,team_names[1]:0} self.difficulty=difficulty
def start(self): self.getPlayers() # print(self.player1.name) # print(self.player2.name) scoreboard = Scoreboard() while self.replayGame != False: round = Round() round.playerTurn(self.player1, self.player2) # print(self.player1.move, self.player2.move) result = Result() result.declareVictor(self.player1, self.player2) roundScore = result.score scoreboard.updateScore(roundScore) replay = Replay() replay.replayGame() self.replayGame = replay.playAgain
def playGame(self): while self.newGame != False: self.newGame = False print("Welcome to Bender's Totally Legit and Not Rigged at All Blackjack Table.") print("You're not a cop, are you? You have to tell me if you're a cop...") self.getPlayers() print("Welcome",self.player.name) self.player.startingCash() print(self.player.name, "has $",self.player.cash,"available") deck = Deck() dealer = Dealer() while self.replayGame != False: if len(deck.currentDeck) <= 10: house = deck.newDeck() round = Round(self) results = Results(self) score = Scoreboard(self) wager = score.placeBet(self.player.cash) if self.newGame == True: break round.startingHands(self.player, dealer, deck, house) round.takeAction(self.player, dealer, deck, house) if self.player.score <= 21 and self.player.score > 0: round.checkDealerHand(self.player, dealer, deck, house) results.determineWinner(self.player, dealer) self.player.cash = score.updateCash(self.player.cash, wager) print(self.player.name, "has $", self.player.cash, "available") replay = KeepPlaying() replay.replayGame(self.player, dealer) self.replayGame = replay.playAgain if self.newGame == False: print("I don't need you. I'll build my own casino. With Blackjack... and hookers... Awww, forget it.") elif self.newGame == True: print("Oops, you're broke! ¯\_(ツ)_/¯") print("Come back when you have some money to lose. (\/)(;,,;)(\/)")
def __init__(self, team1_name="e1", j1_name="joueur1", j1_random=False, j3_name="joueur3", j3_random=True, team2_name="e2", j2_name="joueur2", j2_random=True,j4_name="joueur4", j4_random=True, score_limit=2000,hidden=False): self.data={"team1_name":team1_name, "j1_name":j1_name, "j1_random":j1_random, "j3_name":j3_name, "j3_random":j3_random, "team2_name":team2_name, "j2_name":j2_name, "j2_random":j2_random,"j4_name":j4_name, "j4_random":j4_random} self.Round=Round(team1_name=self.data["team1_name"], j1_name=self.data["j1_name"], j1_random=self.data["j1_random"], j3_name=self.data["j3_name"], j3_random=self.data["j3_random"], team2_name=self.data["team2_name"], j2_name=self.data["j2_name"], j2_random=self.data["j2_random"], j4_name=self.data["j4_name"], j4_random=self.data["j4_random"], number=0,pioche=Hand(name="pioche",cards=[Card(i,j) for i in const.liste_numero for j in const.liste_couleur]),hidden=hidden) #self.Round=Round(team1_name=team1_name, j1_name=j1_name, j1_random=j1_random, j3_name=j3_name, j3_random=j3_random, #team2_name=team2_name, j2_name=j2_name, j2_random=j2_random,j4_name=j4_name, j4_random=j4_random, hidden=hidden ) #faire un tableau de manche self.limit=score_limit self.score={team1_name:0,team2_name:0} self.hidden=hidden
def startNewRound(self): if (len(self.players) > 1): self.roundObject = Round(self) while (True): if ( len(self.players) > 1 ): #check if players in game are more than 1; sam pac ne mors spilat, duh print("REMOVING PLAYERS WITHOUT MONEY") self.removePlayersWithNoMoney() print("ROUND " + str(self.roundCounter) + " START") result = self.roundObject.startRound(self) if (result == False): return False self.roundObject.reset(self) else: return False else: return False
class Game: def __init__(self, server, max_score=100, pass_dirs=('left', 'right', 'across', 'hold')): self.server = server self.logger = Logger() self.timer = Timer(server) self.num_players = len(server.usernames) self.scores = [0] * self.num_players self.max_score = max_score self.round_num = 1 self.pass_dirs = pass_dirs self.pass_dir_num = 0 def get_scores_str(self): s = 's:' for i in range(self.num_players): s += self.server.usernames[i] + ' ' + str(self.scores[i]) + ' ' return s def play(self): while max(self.scores) < self.max_score: pass_dir = self.pass_dirs[self.pass_dir_num] self.curr_round = Round(self, pass_dir) self.curr_round.play() for i in range(self.num_players): self.scores[i] += self.curr_round.scores[i] self.logger.log_round(round_num=self.round_num, pass_dir=pass_dir, player=self.server.usernames[i], round_score=self.curr_round.scores[i], cum_score=self.scores[i]) self.server.broadcast(self.get_scores_str()) self.round_num += 1 self.pass_dir_num = (self.pass_dir_num + 1) % len(self.pass_dirs) def set_pass_dir(self, dir): self.pass_dir_num = self.pass_dirs.index(dir) self.curr_round.pass_dir = dir def set_score(self, player_num, score): self.scores[player_num] = score self.server.broadcast(self.get_scores_str())
def new_round(self,round_number) : pioche=Hand(name="pioche",cards=[],sort=False) # the last round was played pioche+=self.Round.teams[0].pli pioche+=self.Round.teams[1].pli # the last round wasn't played players_in_order=self.Round.shortkey() #changer ordre a chaque manche ???? for player in players_in_order : pioche+=player.Hand assert(pioche.rest["cards"]==32) for card in pioche.cards : # it seems to work card.reset() self.Round=Round(team1_name=self.data["team1_name"], j1_name=self.data["j1_name"], j1_random=self.data["j1_random"], j3_name=self.data["j3_name"], j3_random=self.data["j3_random"], team2_name=self.data["team2_name"], j2_name=self.data["j2_name"], j2_random=self.data["j2_random"], j4_name=self.data["j4_name"], j4_random=self.data["j4_random"], number=round_number,pioche=pioche,hidden=self.hidden)
def new_round(self,round_number) : pioche=Hand(name="pioche",cards=[],sort=False) # the last round was played pioche+=self.round.teams[0].pli pioche+=self.round.teams[1].pli # the last round wasn't played players_in_order=self.round.getPlayersInOrder() #changer ordre a chaque manche ???? for player in players_in_order : pioche+=player.Hand assert(pioche.rest["cards"]==32) # Reset trump and value information of the previous round for card in pioche.cards : # it seems to work card.reset() self.round=Round(team_names=self.data["team_names"], player_names=self.data["player_names"], player_bots=self.data["player_bots"], number=round_number,pioche=pioche, difficulty=self.difficulty)
def __init__( self, width=0.1, aBoundary=1, min=None, underflow_bin=None, max=None, overflow_bin=None, valid=returnTrue, retvalue='lowedge', ): self._round = Round(width=width, aBoundary=math.log10(aBoundary), retvalue=retvalue) self.width = width self.aBoundary = aBoundary self.min = min self.underflow_bin = underflow_bin self.max = max self.overflow_bin = overflow_bin self.valid = valid
def run_game(game): while True: # Run round until completion and then get results winner = game.current_round.runRound() results = game.end_round(winner) hold_master = results[0] # New master hold_puppet = results[1] # New puppet winner = results[2] # Round winner winner_role = results[3] # Winner's role tagger = results[4] # User who tagged comment # Increment consecutive master wins counter if winner_role == "master": game.master_wins += 1 # Update the scoreboard game.update_score(winner, winner_role, tagger) # Format end-of-round report report = game.get_report(winner, winner_role, tagger) # Distribute the report report_comment = game.send_report(report) # Update scoreboard with permalink to report game.scoreboard[str( winner)]['last_round'] = report_comment.permalink game.scoreboardDB.update({'last_round': report_comment.permalink}, find_stuff.username == str(winner)) # Remake the scoreboard with new info game.make_score(report_comment, winner) # Create next round if game.master_wins > 2: game.current_round = Round(game, puppet=hold_puppet) game.master_wins = 0 else: game.current_round = Round(game, hold_master, hold_puppet)
def play_all_rounds(self): self.state = GameState.TABLE_ROUND round_starter_index = self.starting_player num_rounds = 0 rounds = [] while num_rounds < 8: num_rounds += 1 logging.info("\nBeginning round {}".format(num_rounds)) if self.trump_revealed: round = Round(trump_suit=self.trump_suit) else: round = Round() self.play_round(round, round_starter_index) round_starter_index = round.winning_player.number rounds.append(round) # logging.info("Round json: {}".format(round.json())) # pprint.pprint(round.json()) # Let all players know what happened here for player in self.players: player.update_end_of_round_info(round) logging.info("Round {} won by {}, worth {} points".format( num_rounds, round.winning_player.name, round.round_pts)) self.game_rounds = list(rounds)
def __init__(game): # Read current scoreboard game.scoreboardDB = TinyDB("player_data.json") game.scoreboard = game.read_score() game.scoreboard_post = reddit.submission(id="ejlnhv") # Count master consecutive wins game.master_wins = 0 # Create initial Round object game.current_round = Round(game) game.current_master = game.current_round.master game.current_puppet = game.current_round.puppet game.run_game()
def _run_rounds(self, number_of_rounds: int, players: [Player, ...]): clear() print(f'Serão {number_of_rounds} rodadas para decidir quem vai ganhar') sleep(2.5) print('Ganha quem tiver mais dinheiro') sleep(2.5) current_round = 1 while current_round <= number_of_rounds: theme = self._draw_theme() secret_world = SecretWord(theme=theme) Round(secret_world, theme, players).run() current_round += 1 return players
def playGame(self): while self.newGame != False: self.newGame = False print( "Welcome to Bender's Totally Legit and Not Rigged at All Blackjack Table." ) print( "You're not a cop, are you? You have to tell me if you're a cop..." ) self.getPlayers() print("Welcome", self.player.name) self.player.startingCash() print(self.player.name, "has $", self.player.cash, "available") deck = Deck() dealer = Dealer() while self.replayGame != False: if len(deck.currentDeck) <= 10: house = deck.newDeck() round = Round(self) results = Results(self) score = Scoreboard(self) wager = score.placeBet(self.player.cash) if self.newGame == True: break round.startingHands(self.player, dealer, deck, house) round.takeAction(self.player, dealer, deck, house) if self.player.score <= 21 and self.player.score > 0: round.checkDealerHand(self.player, dealer, deck, house) results.determineWinner(self.player, dealer) self.player.cash = score.updateCash(self.player.cash, wager) print(self.player.name, "has $", self.player.cash, "available") replay = KeepPlaying() replay.replayGame(self.player, dealer) self.replayGame = replay.playAgain if self.newGame == False: print( "I don't need you. I'll build my own casino. With Blackjack... and hookers... Awww, forget it." ) elif self.newGame == True: print("Oops, you're broke! ¯\_(ツ)_/¯") print( "Come back when you have some money to lose. (\/)(;,,;)(\/)" )
def __init__(self): self.round = Round() self.s = Serialization()
class Game(object): ############################################################## # Function Name: Constructor # Purpose: Constructor # Parameters: # self # Assistance Received: None ############################################################## def __init__(self): self.round = Round() self.s = Serialization() ############################################################## # Function Name: startGame # Purpose: starts the game # Parameters: # self # Assistance Received: None ############################################################## def startGame(self): choice = 0 while choice < 1 or choice > 2 or choice == 0: print("(1) Start new Game") print("(2) Load Game") choice = int(input("Selection: ")) if choice < 1 or choice > 2: print("Please enter a valid input") if choice == 1: self.round.setUpPlayers() self.round.setUpRound() self.round.determinePlayer() self.round.display() elif choice == 2: self.resumeGame() self.round.display() ############################################################## # Function Name: resumeGame # Purpose: loads game from file # Parameters: # self # Assistance Received: None ############################################################## def resumeGame(self): comScore = [0, 0, 0] humScore = [0, 0, 0] humHand = [[], [], []] humCapture = [[], [], []] computerHand = [[], [], []] computerCapture = [[], [], []] layout = [] stockPile = [] numComPlayers = 0 numHumanPlayers = 0 nextPlayer = "" fileName = input( "What is the name of the file you would like to resume: ") self.s.setFileName(fileName) #Round roundNum = self.s.getRound() self.round.setRound(roundNum) #Computer and Human comScore, computerHand, computerCapture, numComPlayers = self.s.getComputer( ) self.round.setComputer(comScore, computerHand, computerCapture, numComPlayers) humScore, humHand, humCapture, numHumanPlayers = self.s.getHuman() self.round.setHuman(humScore, humHand, humCapture, numHumanPlayers) #Layout and Stock Pile layout = self.s.getLayout() self.round.setLayout(layout) stockPile = self.s.getStockPile() self.round.setStockPile(stockPile) #Next Player nextPlayer = self.s.getNextPlayer() self.round.setNextPlayer(nextPlayer)
def test_hand_add_card(): game = Game() round = Round(game) card = Card('Hearts', 'Two') round.player.add_card(card) assert round.player.__str__() == "hand is:\n Two of Hearts"
def cycle_rounds(self): while True: round = Round(self.players_list, self.diller, self.bank, Deck()) round.indicate_diller_for_bank() round.push_bets() round.give_cards_to_players() round.players_move() round.diller_turn() round.comprasion_points() round.refresh_round() self.all_checks()
class Game(): def __init__(self, team_names=["e1","e2"], player_names=["j1","j2","j3","j4"], player_bots=[False,True,True,True], score_limit=2000,hidden=False, difficulty="beginner"): GraphicManager.hidden=hidden self.data= {"team_names":team_names, "player_names":player_names, "player_bots":player_bots} self.round=Round(team_names=self.data["team_names"], player_names=self.data["player_names"], player_bots=self.data["player_bots"], number=0,pioche=Hand(name="pioche",cards=[Card(i,j) for i in const.NUMBERS for j in const.COLORS[:4]]), difficulty=difficulty) self.limit=score_limit self.score={team_names[0]:0,team_names[1]:0} self.difficulty=difficulty def result(self): # normalement mise nest pas char total_points=self.round.teams[0].pli.count_points()+self.round.teams[1].pli.count_points() assert(total_points==162 or total_points==182) #compte les points par équipe pas encore de 10 de der if self.round.surcoinche : multiplicator = 4 elif self.round.coinche : multiplicator = 2 else : multiplicator =1 for team in self.round.teams : if team.bet != None: capot= team.bet==250 and len(team.pli.cards)==32 #bool capot generale=(team.players[0].plis==8 and team.players[0].generale==True ) or ( team.players[1].plis==8 and team.players[1].generale==True) #bool generale #cas 1 : réussite du contrat if team.bet<=team.pli.points or capot or generale : #faire cas général : compteur de pli gagné par player #cas 1.1 : coinché ou surcoinché if self.round.coinche : self.score[team.name] += team.bet*multiplicator # seulement points contrats self.score[self.round.teams[(team.number+1)%2].name] += 0 #points defense #cas 1.2 : normal else : self.score[team.name] += team.bet # seulement points contrats self.score[self.round.teams[(team.number+1)%2].name] += self.round.teams[(team.number+1)%2].pli.points #points defense #It's a success GraphicManager.result(team=team,win=True,score=self.score) #UI #cas 2 : échec du contrat else : self.score[self.round.teams[(team.number+1)%2].name] += 160*multiplicator #It's a fail GraphicManager.result(team=team,win=False,score=self.score) #UI def end_round(self) : self.result() for team in self.score: if self.score[team]>self.limit: #error GraphicManager.end(team=team,game=self) #UI return False return True def new_round(self,round_number) : pioche=Hand(name="pioche",cards=[],sort=False) # the last round was played pioche+=self.round.teams[0].pli pioche+=self.round.teams[1].pli # the last round wasn't played players_in_order=self.round.getPlayersInOrder() #changer ordre a chaque manche ???? for player in players_in_order : pioche+=player.Hand assert(pioche.rest["cards"]==32) # Reset trump and value information of the previous round for card in pioche.cards : # it seems to work card.reset() self.round=Round(team_names=self.data["team_names"], player_names=self.data["player_names"], player_bots=self.data["player_bots"], number=round_number,pioche=pioche, difficulty=self.difficulty) def reinitialize(self): self.new_round(round_number=0) self.score={self.data["team_names"][0]:0,self.data["team_names"][1]:0} def run(self): while True : #game root round_number = 0 # The first Round is the Round 1 played = True while True: # round root while True : #round of assertion : is a trump is taken or not round_number+=1 self.new_round(round_number) played=self.round.run() if played : break if not self.end_round(): break #this trick automatize the launch of a new game if all players are bots if GraphicManager.newGame(isBot= ( 2+sum(self.data["player_bots"]) ) %5): #UI break else : self.reinitialize()
class Game(): def __init__(self, team1_name="e1", j1_name="joueur1", j1_random=False, j3_name="joueur3", j3_random=True, team2_name="e2", j2_name="joueur2", j2_random=True,j4_name="joueur4", j4_random=True, score_limit=2000,hidden=False): self.data={"team1_name":team1_name, "j1_name":j1_name, "j1_random":j1_random, "j3_name":j3_name, "j3_random":j3_random, "team2_name":team2_name, "j2_name":j2_name, "j2_random":j2_random,"j4_name":j4_name, "j4_random":j4_random} self.Round=Round(team1_name=self.data["team1_name"], j1_name=self.data["j1_name"], j1_random=self.data["j1_random"], j3_name=self.data["j3_name"], j3_random=self.data["j3_random"], team2_name=self.data["team2_name"], j2_name=self.data["j2_name"], j2_random=self.data["j2_random"], j4_name=self.data["j4_name"], j4_random=self.data["j4_random"], number=0,pioche=Hand(name="pioche",cards=[Card(i,j) for i in const.liste_numero for j in const.liste_couleur]),hidden=hidden) #self.Round=Round(team1_name=team1_name, j1_name=j1_name, j1_random=j1_random, j3_name=j3_name, j3_random=j3_random, #team2_name=team2_name, j2_name=j2_name, j2_random=j2_random,j4_name=j4_name, j4_random=j4_random, hidden=hidden ) #faire un tableau de manche self.limit=score_limit self.score={team1_name:0,team2_name:0} self.hidden=hidden def result(self): # normalement mise nest pas char total_points=self.Round.teams[0].pli.count_points()+self.Round.teams[1].pli.count_points() assert(total_points==162 or total_points==182) #compte les points par équipe pas encore de 10 de der if self.Round.surcoinche : multiplicator = 4 elif self.Round.coinche : multiplicator = 2 else : multiplicator =1 for team in self.Round.teams : if team.bet != None: capot= team.bet==250 and len(team.pli.cards)==32 #bool capot generale=(team.players[0].plis==8 and team.players[0].generale==True ) or ( team.players[1].plis==8 and team.players[1].generale==True) #bool generale #cas 1 : réussite du contrat if team.bet<=team.pli.points or capot or generale : #faire cas général : compteur de pli gagné par player if not self.hidden: #GRAPHIC print("l'équipe {} a réussit son contrat".format(team.name)) #cas 1.1 : coinché ou surcoinché if self.Round.coinche : self.score[team.name] += team.bet*multiplicator # seulement points contrats self.score[self.Round.teams[(team.number+1)%2].name] += 0 #points defense #cas 1.2 : normal else : self.score[team.name] += team.bet # seulement points contrats self.score[self.Round.teams[(team.number+1)%2].name] += self.Round.teams[(team.number+1)%2].pli.points #points defense #cas 2 : échec du contrat else : if not self.hidden: #GRAPHIC print("l'équipe {} a chuté ".format(team.name)) self.score[self.Round.teams[(team.number+1)%2].name] += 160*multiplicator def end_round(self) : self.result() if not self.hidden: #GRAPHIC print(self.score) for team in self.score: if self.score[team]>self.limit: #error if not self.hidden: #GRAPHIC print(self.Round.atout, self.Round.teams[0].bet, self.Round.teams[1].bet) print( " l'équipe {} a gagné avec {} ".format(team, self.score)) return False return True def new_round(self,round_number) : pioche=Hand(name="pioche",cards=[],sort=False) # the last round was played pioche+=self.Round.teams[0].pli pioche+=self.Round.teams[1].pli # the last round wasn't played players_in_order=self.Round.shortkey() #changer ordre a chaque manche ???? for player in players_in_order : pioche+=player.Hand assert(pioche.rest["cards"]==32) for card in pioche.cards : # it seems to work card.reset() self.Round=Round(team1_name=self.data["team1_name"], j1_name=self.data["j1_name"], j1_random=self.data["j1_random"], j3_name=self.data["j3_name"], j3_random=self.data["j3_random"], team2_name=self.data["team2_name"], j2_name=self.data["j2_name"], j2_random=self.data["j2_random"], j4_name=self.data["j4_name"], j4_random=self.data["j4_random"], number=round_number,pioche=pioche,hidden=self.hidden) def play(self): if self.Round.choose_atout() : #choisir valeur par defaut pour les test players_in_order=self.Round.shortkey() #changer ordre a chaque manche ???? self.Round.cards_update() for i in range(8): if not self.hidden: #GRAPHIC print("pli {} : \n \n".format(i)) players_in_order=self.Round.play_pli( players=players_in_order, pli_number=i+1) #erreur dans le decompte des plis confusion avec les tas player bug a iteration2 a priori fonctionne : confusion entre la position dans la main et celles des cartes possibles for k in range(2): if not self.hidden: #GRAPHIC self.Round.teams[k].pli.display() return True #a trump was picked else : return False #nobody picked a trump : it's a white round def reinitialize(self): self.new_round(round_number=0) self.score={self.data["team1_name"]:0,self.data["team2_name"]:0} def run(self): while True : #game root round_number = -1 # to start the first at 0 played = True while True: # round root while True : #round of assertion : is a trump is taken or not round_number+=1 self.new_round(round_number) played=self.play() if played : break if not self.end_round(): break if not generic.decision(question="une nouvelle partie", ouverte=False,random=self.hidden): break else : self.reinitialize()