Hello, I am at a beginner level with Python (been learning a couple months), and trying to create a simple auction draft tool for me and my friends’ fantasy disc golf league. I have seen some code out there from others, but I’d like to make it myself just for practice. If you’re not familiar, here is how an auction draft works: the drafters take turns “nominating” players to be auctioned off. The roster spots to fill are 4 players from the “mixed” division and 2 players from the female division. Each drafter starts with a set amount of money, and there is a constraint on the maximum bid. The drafter can’t bid more money than they have, and also must keep at least $10 per roster spot they have left to fill.
I foresee doing the actual auctioning outside of the Python tool. I would like to be able to use a function with a few arguments to enter in after each draft selection: who drafted the player, player name, how much the player cost, which division they were in (“mixed” or female). The tool would then return some information to help simplify the drafting process: how much money each drafter has left, how many roster spots in which divisions each drafter has left, the max bid for each drafter, etc.
My hang-up is knowing what, if anything, I need nested within a class. So I’ve pasted some code, and I want it to do this for each iteration of the “team” variable (which is the different teams that will be populated throughout the auction for each drafter).
# Defining variables
player_cost = 0
division = [‘fpo’, ‘mpo’]
starting_amount = 1000
starting_amount = 1000
amount_spent = 0
fpo_remaining = 0
mpo_remaining = 0
players_remaining = fpo_remaining + mpo_remaining
amount_remaining = starting_amount - amount_spent
max_bid = amount_remaining - (10 * players_remaining)
#Not sure what else to put in the constructor? would the arguments be like __init__(self, and then the player, player_cost, etc?) def __init__(self, player, player_cost, division): self.player = player self.player_cost = player_cost self.division = division def add_to_team(team, player, player_cost, division): team.append(player) amount_spent += player_cost # exception for if somebody picks wrong number of players per division if division == 'fpo': fpo_players.append(player) else: division == 'mpo' mpo_players.append(player) # Setting limits on number of players from each division if mpo_players in team > 4: print ('Drafter has drafted too many MPO players!!') if fpo_players in team > 2: print ('Drafter has drafted too many FPO players!!') if player_cost > max_bid: print('Drafter bid higher than max bid!!') # have method that returns maximum bid, how many players they have left, etc. - print out team name and then def details_update(team): for i in team: i = 0 print('Money Left = ' '$ ' + str(amount_remaining)) print('Maximum Bid Possible = ' '$ ' + str(max_bid)) i+=1