original_docstring: 
          This method simulates a single turn in a game.
          
docstring: This method simulates a single turn in a game.
docstring_tokens: This method simulates a single turn in a game .
code: def play_turn(self):
          """
          This method simulates a single turn in a game.
          """
          chosen_cards = {}
          for player_name in self.players.keys():
              observation = self.get_observation(player_name)
              action_space = self.get_action_space(player_name)
              last_log_player = self.gamelog[self.gamelog['player'] == player_name].iloc[-1]
              reward = last_log_player['reward']
              player = self.players[player_name]
  
              # the player selects a type of card
              chosen_card = player.act(reward=reward,
                                       observation=observation,
                                       action_space=action_space)
              chosen_cards[player_name] = chosen_card
  
              # next we determine the new player_state
              player.table.append(chosen_card)
              player.hand = [card for card in player.hand if card is not chosen_card]
          for player_name, chosen_card in chosen_cards.items():
              self.log_user_action(player_name=player_name, action=chosen_card)
  
          # last thing we need to do is ensure that everybody switches hand
          current_hands = [p.hand for p in self.players.values()]
          for i, name in enumerate(self.players.keys()):
              self.players[name].hand = current_hands[i - 1]
  
          # if this is the last turn of the round we want to remove the table
          if self.turn % self.cards_per_player == 0:
              self.calc_scores()
              self.reset_table()
          # the very last thing is to update the turn
          self.turn += 1
  
          if self.verbose:
              info = {}
              info['game'] = self.game_id
              info['round'] = self.round
              info['turn'] = self.turn
              info['table'] = {_: [c.type for c in self.players[_].table] for _ in self.players.keys()}
              info['points'] =  {_: self.calc_points(_) for _ in self.players.keys()}
              pprint.pprint(info, width=2)
code_tokens: def play_turn ( self ) : chosen_cards = { } for player_name in self . players . keys ( ) : observation = self . get_observation ( player_name ) action_space = self . get_action_space ( player_name ) last_log_player = self . gamelog [ self . gamelog [ 'player' ] == player_name ] . iloc [ - 1 ] reward = last_log_player [ 'reward' ] player = self . players [ player_name ] chosen_card = player . act ( reward = reward , observation = observation , action_space = action_space ) chosen_cards [ player_name ] = chosen_card player . table . append ( chosen_card ) player . hand = [ card for card in player . hand if card is not chosen_card ] for player_name , chosen_card in chosen_cards . items ( ) : self . log_user_action ( player_name = player_name , action = chosen_card ) current_hands = [ p . hand for p in self . players . values ( ) ] for i , name in enumerate ( self . players . keys ( ) ) : self . players [ name ] . hand = current_hands [ i - 1 ] if self . turn % self . cards_per_player == 0 : self . calc_scores ( ) self . reset_table ( ) self . turn += 1 if self . verbose : info = { } info [ 'game' ] = self . game_id info [ 'round' ] = self . round info [ 'turn' ] = self . turn info [ 'table' ] = { _ : [ c . type for c in self . players [ _ ] . table ] for _ in self . players . keys ( ) } info [ 'points' ] = { _ : self . calc_points ( _ ) for _ in self . players . keys ( ) } pprint . pprint ( info , width = 2 )
short_docstring: This method simulates a single turn in a game.
short_docstring_tokens: This method simulates a single turn in a game .
comment: """
          This method simulates a single turn in a game.
          """$SEP$# the player selects a type of card$SEP$# next we determine the new player_state$SEP$# last thing we need to do is ensure that everybody switches hand$SEP$# if this is the last turn of the round we want to remove the table$SEP$# the very last thing is to update the turn